Hi ! Sorry for my late answer I was far from my computer for some days…
I’ve discovered with the help of ‘Gugusse Roller’ that my first mistake was to look at the images I’ve saved in 16bits with Photoshop… and it was awful, whatever I was doing with the levels… Then I tried with Resolve on his advices, and miracle, playing with the levels revealed everything correctly… I don’t understand why there is such an huge difference between those 2 softwares… So know it’s ‘working’… but really to slow, I need at least 10" for each image (1 image/color layer + Merge and save merge…)… So… 10h scanning for 1 film… Perhaps is my Raspberry to weak, surely it is…
If you want the code, here is the one i’ve done, I’m sure that it’s not optimum
from PIL import Image
from pypylon import pylon
import cv2
import numpy as np
import serial
from io import BytesIO
import time
import os
import platform
tl_factory = pylon.TlFactory.GetInstance()
camera = pylon.InstantCamera()
camera.Attach(tl_factory.CreateFirstDevice())
camera.Open()
camera.PixelFormat.SetValue(‘Mono12p’)
camera.ExposureTime = 200000
camera.MaxNumBuffer = 3
converter = pylon.ImageFormatConverter()
converter.OutputPixelFormat = pylon.PixelType_Mono16
converter.OutputBitAligment = “MsbAligned”
#img = np.ndarray(buffer=image.GetBuffer(),dtype=np.uint16)
stream = BytesIO()
camera.StartGrabbing(pylon.GrabStrategy_OneByOne)
count = 1
ser = serial.Serial(’/dev/ttyACM0’, 115200, timeout=1)
ser.flush()
while True:
number = ser.read()
if number !=b’’ :
if int.from_bytes(number, byteorder='big') == 18:
while camera.IsGrabbing():
result = camera.RetrieveResult(5000, pylon.TimeoutHandling_ThrowException)
result.GrabSucceeded() #camera.IsGrabbing()
time.sleep(1)
image = converter.Convert(result)
rouge = image.GetArray()
#rouge = np.array(image(), shape= (image.GetHeight(), image.GetWidth()),dtype=np.uint16)
break
if int.from_bytes(number, byteorder='big') == 19:
while camera.IsGrabbing():
result = camera.RetrieveResult(5000, pylon.TimeoutHandling_ThrowException)
result.GrabSucceeded() #camera.IsGrabbing()
time.sleep(1)
image = converter.Convert(result)
vert = image.GetArray()
break
if int.from_bytes(number, byteorder='big') == 20:
while camera.IsGrabbing():
result = camera.RetrieveResult(5000, pylon.TimeoutHandling_ThrowException)
result.GrabSucceeded()
time.sleep(1)
image = converter.Convert(result)
bleu = image.GetArray()
time.sleep(1)
img=cv2.merge([bleu, vert, rouge])
#res=cv2.resize(img, (720, 542), interpolation = cv2.INTER_LINEAR)
#show=cv2.bitwise_not(res)
#cv2.imshow('out',res)
#cv2.waitKey(20)
cv2.imwrite('/media/pi/SSD/TRICHROTEST/2S82021005%06d.tif'%count, img)
count += 1
break
result.Release()
camera.StopGrabbing()
camera.Close()
else :
time.sleep(0.01)
Cheers !