i am trying to make a calibration program for machine vision with Halcon. What i am doing is i use the image acquisition assistant to connect to my external camera and then i insert the generated code for the acquisition of a picture. Then i am using find_calib_object and i get the following error : Image to process has wrong gray value type (HALCON error code: 9001) This is the picture i've taken: enter image description here
My question is how to fix this error and how to make the picture rgb
This is my code: write_string(WindowHandle, 'Generating a position and sending it to the robot...') * Using procedure to generate the position and send the robot
PositionGeneration (Socket, WindowHandle, TupleWithPositions)
* Image Acquisition 01: Code generated by Image Acquisition 01
open_framegrabber ('GenICamTL', 0, 0, 0, 0, 0, 0, 'default', -1, 'default', -1, 'false', 'default', 'Zivid_DEV_21513D73', 0, -1, AcqHandle)
grab_image_start (AcqHandle, -1)
grab_image_async (Image, AcqHandle, -1)
* Image Acquisition 01: Do something
close_framegrabber (AcqHandle)
dev_display (Image)
* Saving the picture
write_image (Image, 'png none', 0, 'Image'+I)
find_calib_object (Image, CalibDataID, 0, 0, I, 'alpha', 0.2)
get_calib_data_observ_contours (Caltab, CalibDataID, 'caltab', 0, 0, I)
get_calib_data_observ_points (CalibDataID, 0, 0, I, Row, Column, Index, Pose)
dev_set_color ('green') dev_display(Image) dev_display (Caltab)
tuple_number (TupleWithPositions, PoseCoordinates) X := PoseCoordinates[0] Y := PoseCoordinates[1] Z := PoseCoordinates[2] A := PoseCoordinates[3] B := PoseCoordinates[4] C := PoseCoordinates[5]
create_pose (X, Y, Z, A, B, C, 'Rp+T', 'abg', 'point', Pose) set_calib_data (CalibDataID, 'tool', I, 'tool_in_base_pose', Pose)
I've tried to change the parameters of the camera but nothing has helped.
If you have an RGB camera, you need to set the open_framegrabber parameters "colorspace" and "bitsperchannel" to correct values.