Bonjour,
Je suis bloqué depuis quelque jours sur un truc.
Il faut faire un programme en Java en utilisant openCv qui prend une image en input.
Nom : tec5.jpg
Affichages : 309
Taille : 313,1 Ko
puis d'identifier les cases coché au dessous de chaque question, et par exemple de sortir en output :
Question1 : on a bien coché la 2ème case
Question2 : on a bien coché la 3ème case
Question3 : on a bien coché la 1ème case
Question4 : on a bien coché la 2ème case
etc... pour chaque image...

J'ai fait un programme en java :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
 
import java.util.ArrayList;
import java.util.List;
 
import org.opencv.core.Core;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
import org.opencv.core.MatOfPoint;
import org.opencv.core.Point;
import org.opencv.core.Rect;
import org.opencv.core.Scalar;
import org.opencv.core.Size;
import org.opencv.imgcodecs.Imgcodecs;
import org.opencv.imgproc.Imgproc;
 
 
public class test {
	public static void main(String[] args) {
		    // Load library openCv3
			System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
		    // Consider the image for processing
		    Mat image = Imgcodecs.imread("C:/input.jpg", Imgproc.COLOR_BGR2GRAY);
		    Mat imageHSV = new Mat(image.size(), CvType.CV_8UC4);
		    Mat imageBlurr = new Mat(image.size(),CvType.CV_8UC4);
		    Mat imageA = new Mat(image.size(), CvType.CV_32F);
		    Imgproc.cvtColor(image, imageHSV, Imgproc.COLOR_BGR2GRAY);
		    Imgproc.GaussianBlur(imageHSV, imageBlurr, new Size(5,5), 0);
		    Imgproc.adaptiveThreshold(imageBlurr, imageA, 255,Imgproc.ADAPTIVE_THRESH_MEAN_C, Imgproc.THRESH_BINARY,7, 5);
		    List<MatOfPoint> contours = new ArrayList<MatOfPoint>();    
		    Imgproc.findContours(imageA, contours, new Mat(), Imgproc.RETR_LIST,Imgproc.CHAIN_APPROX_SIMPLE);
		    for(int i=0; i< contours.size();i++){
		        if (Imgproc.contourArea(contours.get(i)) > 50 ){
		            Rect rect = Imgproc.boundingRect(contours.get(i));
		            if ((rect.height > 35 && rect.height < 60) && (rect.width > 35 && rect.width < 60))
		            {
		            	Imgproc.rectangle(image, new Point(rect.x,rect.y), new Point(rect.x+rect.width,rect.y+rect.height),new Scalar(0,0,255));
		            }
		        }
		    }
		    Imgcodecs.imwrite("C:/Users/output.png",image);
		}
}
le programme me cadre les carrés non coché qui sont au dessus de chaque question, c'est tout.
Voila à quoi correspond l'output.
Nom : lena1.png
Affichages : 238
Taille : 781,4 Ko

Merci pour vos aides.