增加对sane单色位图的处理
This commit is contained in:
parent
26623166b2
commit
e2c6fc7c52
|
@ -2006,9 +2006,17 @@ int MainWindow::sane_ex_callback(SANE_Handle hdev, int code, void *data, unsigne
|
|||
|
||||
HGUInt imgType = 0;
|
||||
if (sane_img->header.format == SANE_FRAME_GRAY)
|
||||
{
|
||||
if (1 == sane_img->header.depth)
|
||||
imgType = HGBASE_IMGTYPE_BINARY;
|
||||
else if (8 == sane_img->header.depth)
|
||||
imgType = HGBASE_IMGTYPE_GRAY;
|
||||
else if (sane_img->header.format == SANE_FRAME_RGB)
|
||||
}
|
||||
else if (sane_img->header.format == SANE_FRAME_RGB
|
||||
&& 24 == sane_img->header.depth)
|
||||
{
|
||||
imgType = HGBASE_IMGTYPE_RGB;
|
||||
}
|
||||
|
||||
HGByte *imgData = sane_img->data;
|
||||
HGImageInfo imgInfo = {(HGUInt)sane_img->header.pixels_per_line, (HGUInt)sane_img->header.lines,
|
||||
|
|
|
@ -126,9 +126,6 @@ HGResult HGAPI HGImgProc_ImageAdjustColors(HGImage image, HGImage destImage,
|
|||
else if (HGBASE_IMGTYPE_BGRA == type || HGBASE_IMGTYPE_RGBA == type)
|
||||
channels = 4;
|
||||
|
||||
uint8_t* p = data + roi.top * imgInfo.widthStep + roi.left * channels;
|
||||
cv::Mat img(roiHeight, roiWidth, CV_8UC(channels), p, imgInfo.widthStep);
|
||||
|
||||
if (NULL == destImage || image == destImage)
|
||||
{
|
||||
if (HGBASE_IMGTYPE_BINARY == type)
|
||||
|
@ -149,6 +146,9 @@ HGResult HGAPI HGImgProc_ImageAdjustColors(HGImage image, HGImage destImage,
|
|||
return ret;
|
||||
}
|
||||
|
||||
uint8_t* p = data + roi.top * imgInfo.widthStep + roi.left * channels;
|
||||
cv::Mat img(roiHeight, roiWidth, CV_8UC(channels), p, imgInfo.widthStep);
|
||||
|
||||
CImageApplyAdjustColors imgApply(brightness, contrast, gamma);
|
||||
imgApply.apply(img, 0);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue