问题
I have this code to try around with halcon. Images are quite greenish, and cannot figure out how to set whitebalance. I cannot find it in the samples, in the documentation, on google, and in the parameters. How is whitebalance set on halcon?
* Image Acquisition 06: Code generated by Image Acquisition 06
* Image Acquisition 06: Attention: The initialization may fail in case parameters need to
* Image Acquisition 06: be set in a specific order (e.g., image resolution vs. offset).
open_framegrabber ('GigEVision', 0, 0, 0, 0, 0, 0, 'default', -1, 'default', 'GtlForceIP=00010dc465ce,10.5.5.144/24', 'false', 'default', 'S1204667', 0, -1, AcqHandle)
set_framegrabber_param (AcqHandle, 'Gain', 5.01187)
set_framegrabber_param (AcqHandle, 'BlackLevel', 240.0)
dev_open_window (0, 0, 500, 300, 'light gray', WindowHandleButton)
i := 0
create_bar_code_model ([], [], BarCodeHandle)
while (i < 100)
grab_image (Image, AcqHandle)
find_bar_code (Image, SymbolRegions, BarCodeHandle, 'auto', DecodedDataStrings)
get_bar_code_result (BarCodeHandle, 'all', 'decoded_types', BarCodeResults)
i:= i+1
endwhile
close_framegrabber (AcqHandle)
回答1:
If you open your camera in HDevelop using Assistants -> Image Acquisition -> Connection tab there is a parameter for setting the color space. When I set it to "yuv" on one of my GigE cameras the image looks green. See if you can modify that value to "rgb" or "gray" or "default". There are also some advanced settings under the "Parameters" tab that you could play with by selecting "Guru" under the visibility settings. But I couldn't find white balance settings for my GigE camera under there. Usually the manufacturer of the camera will supply software to allow you to configure advanced parameters (IDS Camera Manager, Basler Pylon etc). You could try opening your camera under the manufacturers software to see if there are any settings for white balance.
来源:https://stackoverflow.com/questions/61773459/halcon-how-to-set-white-balance