26 lines
551 B
C++
26 lines
551 B
C++
#include <algorithm>
|
|
#include <opencv2/core.hpp>
|
|
#include <opencv2/highgui.hpp>
|
|
#include <opencv2/imgproc.hpp>
|
|
#include <iostream>
|
|
|
|
using namespace cv;
|
|
|
|
int main(){
|
|
Mat_<Vec3b> orange = imread("orange1.jpg", IMREAD_COLOR);
|
|
|
|
Vec3b black = Vec3b(0,0,0);
|
|
for(int i = 0; i < orange.rows; i++){
|
|
for(int j = 0; j < orange.cols; j++){
|
|
if(orange(i,j)[2] < 164 && !(orange(i,j)[1] < orange(i,j)[2])){
|
|
orange(i,j) = black;
|
|
}
|
|
}
|
|
}
|
|
|
|
imshow("img", orange);
|
|
|
|
waitKey();
|
|
return 0;
|
|
}
|