Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Heasder inclusion
- #include <stdio.h>
- #include <cv.h>
- #include <highgui.h>
- #include <opencv2/imgproc/imgproc.hpp>
- #include <opencv2/video/tracking.hpp>
- #include <sstream>
- #include <string>
- #include <fstream>
- #include <pthread.h>
- #include <math.h>
- #include <iostream>
- #include <vector>
- //Namespace Declaration
- using namespace cv;
- using namespace std;
- int main(int argc, char **argv){
- Mat im_src = imread(argv[1],-1);
- Mat im_gray = im_src;
- Mat img_bw = im_gray > 200;
- imshow("img_bw",img_bw);
- Mat in = img_bw;
- for(int row = 1; row <= 1; ++row) {
- unsigned char* inp = in.ptr<unsigned char>(row);
- for (int col = 0; col < in.cols; ++col) {
- if (*inp++ == 0) {
- std::cout << '1';
- } else {
- // std::cout << '0';
- std::cout << "Row : " << row << " Col : " << col << " Value : 0 " << endl;
- }
- }
- }
- imshow("img_bw modified",img_bw);
- waitKey(0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement