【发布时间】:2013-12-23 11:34:12
【问题描述】:
我基本上尝试了一些方法来修改这里已经存在的问题的像素数据。但是,没有什么能正常工作。
我正在开发 iOS OpenCV2.framework。
我已经实现了以下方法,但它没有修改 outputImage。
UIImage *inputUIImage = [UIImage imageName:@"someImage.png"];
UIImage *outputUIImage = nil;
cv::Mat inputImage = <Getting this from a method that converts UIImage to cv::Mat: Working properly>
cv::Mat outputImage;
inputImage.copyTo(outputImage);
//processing...
for(int i=0; i < outputImage.rows; i++)
{
for (int j=0; j<outputImage.cols; j++)
{
Vec4b bgrColor = outputImage.at<Vec4b>(i,j);
//converting the 1st channel <assuming the sequence to be BGRA>
// to a very small value of blue i.e. 1 (out of 255)
bgrColor.val[0] = (uchar)1.0f;
}
}
outputUIImage = <Converting cv::Mat to UIImage via a local method : Working properly>
self.imageView1.image = inputUIImage;
self.imageView2.image = outputUIImage;
//here both images are same in colour. no changes.
谁能告诉我我错过了什么?
【问题讨论】: