halcon-rgb3_to_gray把RGB图像转换为灰度图像

在HDevelop中

read_image (Image, 'D:/bb/tu/ma.jpg')
decompose3(Image, ImageR, ImageG, ImageB)
rgb3_to_gray(ImageR,ImageG,ImageB,GrayImage)
*将RGB图像转换为灰度图像
*参数1:输入图像(红色通道)
*参数2:输入图像(绿色通道)
*参数3:输入图像(蓝色通道)
*参数4:输出灰度图像


dev_display(GrayImage)

在QtCreator中

  HObject  ho_Image, ho_ImageR, ho_ImageG, ho_ImageB;
  HObject  ho_GrayImage;
  ReadImage(&ho_Image, "D:/bb/tu/ma.jpg");
  Decompose3(ho_Image, &ho_ImageR, &ho_ImageG, &ho_ImageB);
  Rgb3ToGray(ho_ImageR, ho_ImageG, ho_ImageB, &ho_GrayImage);
  //将RGB图像转换为灰度图像
  //参数1:输入图像(红色通道)
  //参数2:输入图像(绿色通道)
  //参数3:输入图像(蓝色通道)
  //参数4:输出灰度图像


  if (HDevWindowStack::IsOpen())
    DispObj(ho_GrayImage, HDevWindowStack::GetActive());

 

 

 

 

 

 

posted @ 2022-04-02 08:45  天子骄龙  阅读(853)  评论(0)    收藏  举报