Transformation from rgb to hsv and conversely
* Transformation from rgb to hsv and conversely read_image(Image,'patras') dev_display(Image) decompose3(Image, Image1, Image2, Image3) trans_from_rgb(Image1,Image2,Image3,ImageH,ImageS,ImageV,'hsv') trans_to_rgb(ImageH,ImageS,ImageV,ImageR,ImageG,ImageB,'hsv') compose3(ImageR,ImageG,ImageB,Multichannel) dev_display(Multichannel)
灰度图取反
*黑白取反
invert_image (ImageResult, ImageInvert)
更丰富的例子,实现彩色图像的饱和度/亮度均衡
dev_close_window () read_image (Image, 'D:/hellowprld/2/2 (2).jpg') dev_open_window_fit_image (Image, 0, 0, -1, -1, WindowHandle) dev_display (Image) *将图像进行通道分解,分别转换为三个通道的RGB图像 decompose3 (Image, Red, Green, Blue) *使用颜色转换将RGB三个通道图像转化为HSV通道的图像 trans_from_rgb (Red, Green, Blue, Hue1, Saturation1, Intensity1, 'hsi') trans_from_rgb (Red, Green, Blue, Hue2, Saturation2, Value2, 'hsv') *饱和度1均衡 equ_histo_image (Saturation1, ImageEquHistoSaturation1) trans_to_rgb(Hue1, ImageEquHistoSaturation1, Intensity1, ImageR, ImageG, ImageB, 'hsi') compose3(ImageR, ImageG, ImageB, Multichannel1) *饱和度2均衡 equ_histo_image (Saturation2, ImageEquHistoSaturation2) trans_to_rgb(Hue2, ImageEquHistoSaturation2, Value2, ImageR, ImageG, ImageB, 'hsv') compose3(ImageR, ImageG, ImageB, Multichannel2) *亮度1均衡 equ_histo_image (Intensity1, ImageEquHistoIntensity1) trans_to_rgb(Hue1, Saturation1, ImageEquHistoIntensity1, ImageR, ImageG, ImageB, 'hsi') compose3(ImageR, ImageG, ImageB, Multichannel3) *亮度2均衡 equ_histo_image (Value2, ImageEquHistoValue2) trans_to_rgb(Hue2, Saturation2, ImageEquHistoValue2, ImageR, ImageG, ImageB, 'hsv') compose3(ImageR, ImageG, ImageB, Multichannel4) *亮度1增加 scale_image (Intensity1, ImageScaleIntensity1, 1, 80) trans_to_rgb(Hue1, Saturation1, ImageScaleIntensity1, ImageR, ImageG, ImageB, 'hsi') compose3(ImageR, ImageG, ImageB, Multichannel5) *亮度2增加 scale_image (Value2, ImageScaleValue2, 1, 80) trans_to_rgb(Hue2, Saturation2, ImageScaleValue2, ImageR, ImageG, ImageB, 'hsv') compose3(ImageR, ImageG, ImageB, Multichannel6) *彩色图提取轮廓 edges_color_sub_pix (Image, colorEdges, 'canny', 1, 20, 40) *彩色转灰度图 count_channels (Image, Channels) if (Channels == 3 or Channels == 4) rgb1_to_gray (Image, Image) endif get_image_size (Image, Width, Height)