diff --git "a/D\303\251veloppement/Marin/Img_Traitement.py" "b/D\303\251veloppement/Marin/Img_Traitement.py" index 8d5879d..7341846 100644 --- "a/D\303\251veloppement/Marin/Img_Traitement.py" +++ "b/D\303\251veloppement/Marin/Img_Traitement.py" @@ -37,17 +37,17 @@ def traitement(self, img, choix): def binarisation(self, img, choix): """ Filtrage de l'image et binarisation de celle-ci""" - kernel=cv2.getStructuringElement(cv2.MORPH_ELLIPSE,(5,5)) #Matrice permettant de définir la taille de travail des filtres + kernel=cv2.getStructuringElement(cv2.MORPH_ELLIPSE,(3,3)) #Matrice permettant de définir la taille de travail des filtres thres=img #En cas de problème dans les choix de filtrage if choix==1: #Choix de filtre Otsu - gauss = cv2.GaussianBlur(img,(5,5),0) #Met un flou gaussien + gauss = cv2.GaussianBlur(img,(3,3),0) #Met un flou gaussien ret3,thres = cv2.threshold(gauss,0,255,cv2.THRESH_BINARY+cv2.THRESH_OTSU) #Applique le filtre d'Otsu elif choix ==2 : #Choix du filtre adaptatif thres= cv2.adaptiveThreshold(img, 255, cv2.ADAPTIVE_THRESH_MEAN_C, cv2.THRESH_BINARY_INV, 3, 3) elif choix ==3 : #Choix du filtre I/e^2 - thres = cv2.GaussianBlur(img,(5,5),0) #Met un flou gaussien + thres = cv2.GaussianBlur(img,(3,3),0) #Met un flou gaussien amp=np.max(thres) exponentielle = math.exp(1) I=amp/exponentielle**2 @@ -73,7 +73,7 @@ def calcul_traitement(self,frame, thres): break area = cv2.contourArea(c) - if area <= 1000: # skip ellipses smaller then + if area <= 10: # skip ellipses smaller then continue #cv2.drawContours(frame, [c], 0, (0,255,0), 3) # calculate moments for each contour @@ -113,7 +113,7 @@ def calcul_traitement(self,frame, thres): frame = cv2.cvtColor(frame, cv2.COLOR_GRAY2RGB) #Dessine un cercle sur tous les blobs de l'image (formes blanches) - cv2.circle(frame, (self.cX, self.cY), 2, (0, 0, 255), -1) + #cv2.circle(frame, (self.cX, self.cY), 2, (0, 0, 255), -1) #Dessiner l'ellipse thresh = cv2.ellipse(frame,self.ellipse,(0,255,0),1) diff --git "a/D\303\251veloppement/Marin/oneCameraCapture.py" "b/D\303\251veloppement/Marin/oneCameraCapture.py" index a698584..65593f6 100644 --- "a/D\303\251veloppement/Marin/oneCameraCapture.py" +++ "b/D\303\251veloppement/Marin/oneCameraCapture.py" @@ -32,6 +32,12 @@ def __init__(self): self.pixel_size = 2.4 #microns (pixels carrés sur les baslers) self.pixel_max = 4095 + elif self.Model == "acA3800-14um": + self.camera.PixelFormat.SetValue('Mono12') + self.tps_exp_min = 50 + self.pixel_size = 1.67 #microns (pixels carrés sur les baslers) + self.pixel_max = 4095 + else : print("Camera non reconnue") diff --git a/NodeMap.pfs b/NodeMap.pfs index 12453ef..27e8597 100644 --- a/NodeMap.pfs +++ b/NodeMap.pfs @@ -1,88 +1,36 @@ # {05D8C294-F295-4dfb-9D01-096BD04049F4} # GenApi persistence file (version 3.1.0) -# Device = Basler::UsbCameraParams -- Basler USB3Vision camera interface -- Device version = 1.0.0 -- Product GUID = 5a809e15-f447-480f-a21f-0fb7256b8400 -- Product version GUID = B0C5F330-6DB8-4BB7-8CDD-82B5AEB2F8D6 +# Device = Basler::UsbCameraParams -- Basler USB3Vision camera interface -- Device version = 1.1.0 -- Product GUID = 5a809e15-f447-480f-a21f-0fb7256b8400 -- Product version GUID = 013D84BE-CAFF-4F46-B657-76B3FE8F99A9 ExposureAuto Off -BalanceWhiteAuto Off GainAuto Off -Width 1920 -Height 1200 -OffsetX 8 -OffsetY 8 +Width 3840 +Height 2748 +OffsetX 0 +OffsetY 0 +LinePitchEnable 0 CenterX 0 CenterY 0 +BinningHorizontal 1 +BinningVertical 1 +DecimationHorizontal 1 +DecimationVertical 1 +ScalingHorizontal 1.00000 ReverseX 0 -ReverseY 0 -PixelFormat Mono8 +PixelFormat Mono12 TestImageSelector Off GainSelector All Gain 0.00000 GainSelector All BlackLevelSelector All -BlackLevel 0.00000 +BlackLevel 20.00000 BlackLevelSelector All Gamma 1.00000 DigitalShift 0 RemoveParameterLimitSelector Gain RemoveParameterLimit 0 RemoveParameterLimitSelector Gain -LightSourcePreset Daylight5000K -BalanceRatioSelector Red -BalanceRatio 1.73950 -BalanceRatioSelector Green -BalanceRatio 1.00000 -BalanceRatioSelector Blue -BalanceRatio 1.96069 -BalanceRatioSelector Red -ColorAdjustmentSelector Red -ColorAdjustmentHue -0.09375 -ColorAdjustmentSelector Yellow -ColorAdjustmentHue 0.06250 -ColorAdjustmentSelector Green -ColorAdjustmentHue 0.09375 -ColorAdjustmentSelector Cyan -ColorAdjustmentHue 0.25000 -ColorAdjustmentSelector Blue -ColorAdjustmentHue -0.06250 -ColorAdjustmentSelector Magenta -ColorAdjustmentHue 0.56250 -ColorAdjustmentSelector Red -ColorAdjustmentSelector Red -ColorAdjustmentSaturation 1.01563 -ColorAdjustmentSelector Yellow -ColorAdjustmentSaturation 0.95313 -ColorAdjustmentSelector Green -ColorAdjustmentSaturation 1.12500 -ColorAdjustmentSelector Cyan -ColorAdjustmentSaturation 1.01563 -ColorAdjustmentSelector Blue -ColorAdjustmentSaturation 1.00000 -ColorAdjustmentSelector Magenta -ColorAdjustmentSaturation 0.96875 -ColorAdjustmentSelector Red -ColorTransformationSelector RGBtoRGB -ColorTransformationValueSelector Gain00 -ColorTransformationValue 1.62500 -ColorTransformationValueSelector Gain01 -ColorTransformationValue -0.46875 -ColorTransformationValueSelector Gain02 -ColorTransformationValue -0.15625 -ColorTransformationValueSelector Gain10 -ColorTransformationValue -0.40625 -ColorTransformationValueSelector Gain11 -ColorTransformationValue 2.06250 -ColorTransformationValueSelector Gain12 -ColorTransformationValue -0.65625 -ColorTransformationValueSelector Gain20 -ColorTransformationValue 0.12500 -ColorTransformationValueSelector Gain21 -ColorTransformationValue -0.84375 -ColorTransformationValueSelector Gain22 -ColorTransformationValue 1.71875 -ColorTransformationSelector RGBtoRGB -ColorTransformationValueSelector Gain00 -ShutterMode Global ExposureMode Timed -ExposureTime 80.0 +ExposureTime 70.0 AcquisitionBurstFrameCount 1 TriggerSelector FrameBurstStart TriggerMode Off @@ -101,12 +49,12 @@ TriggerActivation RisingEdge TriggerSelector FrameStart TriggerDelay 0 AcquisitionFrameRateEnable 0 -AcquisitionFrameRate 100.00000 +AcquisitionFrameRate 16.00000 DeviceLinkSelector 0 -DeviceLinkThroughputLimitMode On +DeviceLinkThroughputLimit 419430400 DeviceLinkSelector 0 DeviceLinkSelector 0 -DeviceLinkThroughputLimit 360000000 +DeviceLinkThroughputLimitMode On DeviceLinkSelector 0 ChunkSelector Gain ChunkEnable 0 @@ -124,31 +72,31 @@ ChunkSelector PayloadCRC16 ChunkEnable 0 ChunkSelector Timestamp ChunkModeActive 0 -AutoTargetBrightness 0.50196 +AutoTargetBrightness 0.50012 AutoFunctionProfile MinimizeGain AutoGainLowerLimit 0.00000 -AutoGainUpperLimit 23.90000 -AutoExposureTimeLowerLimit 80.0 -AutoExposureTimeUpperLimit 500000.0 +AutoGainUpperLimit 10.64659 +AutoExposureTimeLowerLimit 70.0 +AutoExposureTimeUpperLimit 350000.0 AutoFunctionROISelector ROI1 -AutoFunctionROIWidth 1920 +AutoFunctionROIWidth 3663 AutoFunctionROISelector ROI2 -AutoFunctionROIWidth 1920 +AutoFunctionROIWidth 3663 AutoFunctionROISelector ROI1 AutoFunctionROISelector ROI1 -AutoFunctionROIHeight 1200 +AutoFunctionROIHeight 2747 AutoFunctionROISelector ROI2 -AutoFunctionROIHeight 1200 +AutoFunctionROIHeight 2747 AutoFunctionROISelector ROI1 AutoFunctionROISelector ROI1 -AutoFunctionROIOffsetX 8 +AutoFunctionROIOffsetX 0 AutoFunctionROISelector ROI2 -AutoFunctionROIOffsetX 8 +AutoFunctionROIOffsetX 0 AutoFunctionROISelector ROI1 AutoFunctionROISelector ROI1 -AutoFunctionROIOffsetY 8 +AutoFunctionROIOffsetY 0 AutoFunctionROISelector ROI2 -AutoFunctionROIOffsetY 8 +AutoFunctionROIOffsetY 0 AutoFunctionROISelector ROI1 AutoFunctionROISelector ROI1 AutoFunctionROIUseBrightness 1 @@ -199,13 +147,13 @@ LineMinimumOutputPulseWidth 0.000 LineSelector Line1 UserOutputValueAll 0 TimerSelector Timer1 -TimerDuration 10.0 +TimerDuration 1.0 TimerSelector Timer1 TimerSelector Timer1 TimerDelay 0.0 TimerSelector Timer1 TimerSelector Timer1 -TimerTriggerSource ExposureStart +TimerTriggerSource FlashWindowStart TimerSelector Timer1 CounterSelector Counter1 CounterEventSource FrameStart @@ -227,14 +175,6 @@ EventSelector FrameStartOvertrigger EventNotification Off EventSelector FrameBurstStartOvertrigger EventNotification Off -EventSelector CriticalTemperature -EventNotification Off -EventSelector OverTemperature -EventNotification Off -EventSelector FrameStartWait -EventNotification Off -EventSelector FrameBurstStartWait -EventNotification Off EventSelector ExposureEnd UserDefinedValueSelector Value1 UserDefinedValue 0