का उपयोग कर किसी छवि से वॉटरमार्क को हटाकर सबसे पहले मेरे पास यह छवि है और मैं ऐसा एप्लिकेशन बनाना चाहता हूं जो इस तरह की छवियों का पता लगा सके और उससे सर्कल (वॉटरमार्क) को हटा सके।opencv
int main(){
Mat im1,im2,im3,gray,gray2,result;
im2=imread(" (2).jpg");
namedWindow("x",CV_WINDOW_FREERATIO);
imshow("x",im2);
//converting it to gray
cvtColor(im2,gray,CV_BGR2GRAY);
// creating a new image that will have the cropped ellipse
Mat ElipseImg(im2.rows,im2.cols,CV_8UC1,Scalar(0,0,0));
//detecting the largest circle
GaussianBlur(gray,gray,Size(5,5),0);
vector<Vec3f> circles;
HoughCircles(gray,circles,CV_HOUGH_GRADIENT,1,gray.rows/8,100,100,100,0);
uchar x;
int measure=0;int id=0;
for(int i=0;i<circles.size();i++){
if(cvRound(circles[i][2])>measure && cvRound(circles[i][2])<1000){
measure=cvRound(circles[i][2]);
id=i;
}
}
Point center(cvRound(circles[id][0]),cvRound(circles[id][1]));
int radius=cvRound(circles[id][2]);
circle(im2,center,3,Scalar(0,255,0),-1,8,0);
circle(im2,center,radius,Scalar(0,255,0),2,8,0);
ellipse(ElipseImg,center,Size(radius,radius),0,0,360,Scalar(255,255,255),-1,8);
cout<<"center: "<<center<<" radius: "<<radius<<endl;
Mat res;
bitwise_and(gray,ElipseImg,result);
namedWindow("bitwise and",CV_WINDOW_FREERATIO);
imshow("bitwise and",result);
// trying to estimate the Intensity of the circle for the thresholding
x=result.at<uchar>(cvRound(circles[id][0]+30),cvRound(circles[id][1]));
cout<<(int)x;
//thresholding the output image
threshold(ElipseImg,ElipseImg,(int)x-10,250,CV_THRESH_BINARY);
namedWindow("threshold",CV_WINDOW_FREERATIO);
imshow("threshold",ElipseImg);
// making bitwise_or
bitwise_or(gray,ElipseImg,res);
namedWindow("bitwise or",CV_WINDOW_FREERATIO);
imshow("bitwise or",res);
waitKey(0);
}
अब तक मैं क्या बना दिया है:
- मैं इसे परिवर्तित
- स्केल के लिए मैं hough हलकों का उपयोग कर और उसके बाद में एक ही त्रिज्या के साथ एक चक्र बनाने के सबसे बड़े वृत्त का पता लगाने के एक नई छवि
- ग्रेस्केल वाले (
bitwise_and
) का उपयोग करके यह नया सर्कल मुझे केवल उस सर्कल के साथ एक छवि दें - थ्रेसहोल्ड कि नई छवि
bitwise_or
सीमा
मेरे समस्या यह है कि इस चक्र के अंदर घुमावदार सफेद लाइन पर किसी भी काले पाठ प्रकट नहीं किया था है का परिणाम है। मैंने थ्रेसहोल्ड के बजाय पिक्सेल मानों का उपयोग कर रंग को हटाने की कोशिश की लेकिन समस्या एक ही समाधान या सुझाव है?
बहुत बढ़िया है, यह बहुत अच्छी तरह से काम, लेकिन मैं गहरे रंग पृष्ठों के साथ समस्या है - गहरे रंग वॉटरमार्क - यह सिर्फ इसलिए यह अंत में किया कुछ भी नहीं की तरह है BW छवि के लिए पूरे वॉटरमार्क नकल, मैं ऐसा ही कुछ के साथ कैसे पेश कर सकते हैं ? –
मध्यवर्ती छवियों की जांच करें: ** अंतर **, ** पृष्ठभूमि **, ** वॉटरमार्क मास्क ** और ** इंटरमीडिएट बाइनरी **। यहां हम ओत्सु विधि का उपयोग करते हैं, इसलिए थ्रेसहोल्डिंग के अधीन छवियां बेहतर थीं। आप देख सकते हैं कि वॉटरमार्क के अंदर के अक्षरों को वॉटरमार्क के एक हिस्से को फसल करके अपेक्षित रूप से विभाजित किया गया है जिसमें टेक्स्ट शामिल है और ओत्सु थ्रेसहोल्डिंग को लागू करना है। यह CV_THRESH_BINARY बनाम CV_THRESH_BINARY_INV का मामला भी हो सकता है। – dhanushka
@dhanushka कृपया कोई भी वेक्टर लूपिंग पार्ट के लिए जावा कोड के साथ मदद कर सकता है। मुझे जावा में कुछ समतुल्य नहीं मिल रहा है। मैंने यहां प्रश्न पोस्ट किया -> http://answers.opencv.org/question/130997/how-to-parse-a-binary-image-pixel-by-pixel-in-java-open-cv/ –