dinesh8_10
April 5, 2006, 07:47:53
Dear sir
i am working with SonyXCD_SX910 camera using VB6. my aim is to process the image data using its intensity values at various pixels according to centroid estimation algorithm. i placed rectangle as overlay to bring signal into desired processing area. the size of overlay rectangle is 300 x300 pixels. i want to find
pixel coordinate which have maxmum intnesity. please telll me about my approach to calculate brightest pixel coordinate ..whether it is right or wrong.....
one more thing u tell me the frame rate of this camera with resolution 640 x480...
code of image availbe function is following : .
global variable declaration
.................................................. ...........
Private DisplayBuffer As ImageBuffer
Private imagedata As Variant
Private coorx, coory As Integer
.................................................. ..............
Private Sub setupDevice()
' Set the color format to monochrome
ICImagingControl1.MemoryCurrentGrabberColorformat = ICY8
ICImagingControl1.ImageRingBufferSize = 30
ICImagingControl1.LiveCaptureContinuous = True
ICImagingControl1.LiveCaptureLastImage = False
ICImagingControl1.LiveDisplay = False
ICImagingControl1.OverlayBitmap.Enable = True
ICImagingControl1.OverlayBitmap.DrawFrameRect RGB(255, 255, 255), 50, 50, 350, 350
ICImagingControl1.OverlayBitmap.DrawLine RGB(255, 255, 255), 50, 200, 350, 200
ICImagingControl1.OverlayBitmap.DrawLine RGB(255, 255, 255), 200, 50, 200, 350
ICImagingControl1.OverlayBitmap.DrawLine RGB(255, 255, 255), 50, 50, 350, 350
ICImagingControl1.OverlayBitmap.DrawLine RGB(255, 255, 255), 50, 350, 350, 50
ICImagingControl1.OverlayBitmap.DrawText RGB(255, 255, 255), 10, 50, "50,50"
ICImagingControl1.OverlayBitmap.DrawText RGB(255, 255, 255), 360, 350, "350,350"
Set DisplayBuffer = ICImagingControl1.ImageBuffers.Item(1)
End Sub
' ICImagingControl1_ImageAvailable
Private Sub ICImagingControl1_ImageAvailable(ByVal BufferIndex As Long)
On Error GoTo err_ImageAvailableHandler
Dim x, y, max As Integer
Dim i, j As Long
Static t As Integer ' use for frame counter
Set DisplayBuffer = ICImagingControl1.ImageBuffers.Item(BufferIndex)
imagedata = DisplayBuffer.GetImageData
ICImagingControl1.OverlayBitmap.DrawText RGB(255, 255, 255), 300, 10, "Frame No." & t
max = imagedata(50, 50)
For y = 50 To 350
For x = 50 To 350
If max < imagedata(x, y) Then
max = imagedata(x, y)
coorx = x + 1
coory = y + 1
End If
Next x
Next y
Text10.Text = coorx ' for display of x coordinate of brightest pixel
Text11.Text = coory ' for display of y coordinate of brightest pixel
Text2.Text = max ' for display of value of brightest pixel
DisplayBuffer.ReleaseImageData imagedata
ICImagingControl1.DisplayImageBuffer DisplayBuffer
t = t + 1
err_ImageAvailableHandler:
Debug.Print Err.Description
End Sub
.................................................. .................................................. .........................
with regards
dinesh kumar meena
i am working with SonyXCD_SX910 camera using VB6. my aim is to process the image data using its intensity values at various pixels according to centroid estimation algorithm. i placed rectangle as overlay to bring signal into desired processing area. the size of overlay rectangle is 300 x300 pixels. i want to find
pixel coordinate which have maxmum intnesity. please telll me about my approach to calculate brightest pixel coordinate ..whether it is right or wrong.....
one more thing u tell me the frame rate of this camera with resolution 640 x480...
code of image availbe function is following : .
global variable declaration
.................................................. ...........
Private DisplayBuffer As ImageBuffer
Private imagedata As Variant
Private coorx, coory As Integer
.................................................. ..............
Private Sub setupDevice()
' Set the color format to monochrome
ICImagingControl1.MemoryCurrentGrabberColorformat = ICY8
ICImagingControl1.ImageRingBufferSize = 30
ICImagingControl1.LiveCaptureContinuous = True
ICImagingControl1.LiveCaptureLastImage = False
ICImagingControl1.LiveDisplay = False
ICImagingControl1.OverlayBitmap.Enable = True
ICImagingControl1.OverlayBitmap.DrawFrameRect RGB(255, 255, 255), 50, 50, 350, 350
ICImagingControl1.OverlayBitmap.DrawLine RGB(255, 255, 255), 50, 200, 350, 200
ICImagingControl1.OverlayBitmap.DrawLine RGB(255, 255, 255), 200, 50, 200, 350
ICImagingControl1.OverlayBitmap.DrawLine RGB(255, 255, 255), 50, 50, 350, 350
ICImagingControl1.OverlayBitmap.DrawLine RGB(255, 255, 255), 50, 350, 350, 50
ICImagingControl1.OverlayBitmap.DrawText RGB(255, 255, 255), 10, 50, "50,50"
ICImagingControl1.OverlayBitmap.DrawText RGB(255, 255, 255), 360, 350, "350,350"
Set DisplayBuffer = ICImagingControl1.ImageBuffers.Item(1)
End Sub
' ICImagingControl1_ImageAvailable
Private Sub ICImagingControl1_ImageAvailable(ByVal BufferIndex As Long)
On Error GoTo err_ImageAvailableHandler
Dim x, y, max As Integer
Dim i, j As Long
Static t As Integer ' use for frame counter
Set DisplayBuffer = ICImagingControl1.ImageBuffers.Item(BufferIndex)
imagedata = DisplayBuffer.GetImageData
ICImagingControl1.OverlayBitmap.DrawText RGB(255, 255, 255), 300, 10, "Frame No." & t
max = imagedata(50, 50)
For y = 50 To 350
For x = 50 To 350
If max < imagedata(x, y) Then
max = imagedata(x, y)
coorx = x + 1
coory = y + 1
End If
Next x
Next y
Text10.Text = coorx ' for display of x coordinate of brightest pixel
Text11.Text = coory ' for display of y coordinate of brightest pixel
Text2.Text = max ' for display of value of brightest pixel
DisplayBuffer.ReleaseImageData imagedata
ICImagingControl1.DisplayImageBuffer DisplayBuffer
t = t + 1
err_ImageAvailableHandler:
Debug.Print Err.Description
End Sub
.................................................. .................................................. .........................
with regards
dinesh kumar meena