OpenCV例程2 how to scan images
2013-08-23 17:19
190 查看
This program shows how to scan image obiects in OpenCV(CV::Mat).
we take an inout image and divide the native color palette(255) with the input. Show C operator[] method, itertors and at function for on-the-fly item address calculation.
The example as follows:
int main()
{
help();
Mat img=imread("lena.jpg");
if(img.empty())
{
cout<<"There is no picture."<<endl;
return -1;
}
int nRows=img.rows;
int nCols=img.cols*img.channels();
int i,j;
uchar* p;
int N=100;
for(i=0;i<nRows;i++)
{
uchar* p=img.ptr<uchar>(i);
for(j=0;j<nCols;j++)
{
p[j]=p[j]/N*N;
}
}
namedWindow("image",1);
imshow("image",img);
waitKey();
return 0;
}
需要理解圖像怎麼存儲的,再去理解怎麼scan的。
run:
we take an inout image and divide the native color palette(255) with the input. Show C operator[] method, itertors and at function for on-the-fly item address calculation.
The example as follows:
int main()
{
help();
Mat img=imread("lena.jpg");
if(img.empty())
{
cout<<"There is no picture."<<endl;
return -1;
}
int nRows=img.rows;
int nCols=img.cols*img.channels();
int i,j;
uchar* p;
int N=100;
for(i=0;i<nRows;i++)
{
uchar* p=img.ptr<uchar>(i);
for(j=0;j<nCols;j++)
{
p[j]=p[j]/N*N;
}
}
namedWindow("image",1);
imshow("image",img);
waitKey();
return 0;
}
需要理解圖像怎麼存儲的,再去理解怎麼scan的。
run:
相关文章推荐
- Ubuntu平台下OpenCV官方教程之how_to_scan_images.cpp例程的编译
- opencv_tutorial 2.2 - How to scan Images,Lookup tables and time measurement with opencv
- OpenCV_Tutorials——CORE MODULE.THE CORE FUNCTIONALITY—— How to scan images, lookup tables and time measurement with OpenCV
- OpenCV--How to scan images, lookup tables and time measurement with OpenCV
- How to scan images, lookup tables and time measurement with OpenCV
- how_to_scan_images
- 怎样扫描图片how to scan images
- How to use OpenCV to capture and display images from a camera
- \tutorial_code\core\how_to_scan_images
- How To Backup Your Android Phone’s Boot, Recovery And System Partition Images -- RomDump
- how to compile kinfu_remake with cuda 9.0 opencv2.4.13.4
- [OpenCV] How to install opencv by compiling source code
- [WebView] How to display local images from a remotely loaded URL web page?
- how to remove untagged / none images
- How to Load Images from a Stream
- How to Troubleshoot Connectivity Issue with 11gR2 SCAN Name (Doc ID 975457.1)
- [Yii Framework] How to embed the css and images in a module
- qt - How can I convert a QImage of format RGB32 to OpenCV::mat? - Stack Overflow
- How to convert an OpenCV cv::Mat into a float* that can be fed into Vlfeat vl_dsift_process ?
- How you can use qemu/kvm base images to be more productive