jOpenCV countdown

JordiCP

Expert
Licensed User
Longtime User
Hi there,

I'm happy to announce that I have wrapped OpenCV for B4J, since I needed it as a development tool for a project in which I am involved.
It is already working, but there are several classes that are still incomplete/untested. However, most of them are already being used and work like a charm

Will be released when I finish the current project and have time to fine-tune the lib ?

Real time VideoCapture and processing from 2 webCams (native and USB-connected)
 

rabbitBUSH

Well-Known Member
Licensed User
Nice contribution , and @Erel was so excited he even forgot the the WOW "like" button . . . . . now that's a great accolade and sign of appreciation.

I just wish I could "get-my-head-around" the B4J platform.
 

jinyistudio

Well-Known Member
Licensed User
Longtime User
good job ! Looking forward to your great work ?
 

Eme Fibonacci

Well-Known Member
Licensed User
Longtime User
Thinking...
ESP32-cam equipment captures images and transmits them over IP. A B4J application using its OpenCV library recognizes barcodes, faces and plates. Everything can be integrate with b4a. Very promising.
 

Peter Simpson

Expert
Licensed User
Longtime User

JordiCP

Expert
Licensed User
Longtime User
Very great job congratulations to @JordiCP . Is the release time of the library determined? I can't wait to try it.
Thanks ?

Possibly 2-3 of weeks for the Windows release with x64 architecture with TBB and ffmpeg support, but it will depend very much on my free time.

It will also include the aruco and face contrib modules. I have started exploring how to generate java bindings for gpuMat, which are not included in the official builds, but there's a lot of work to be done here yet, so I guess that this part will come later.
 

JordiCP

Expert
Licensed User
Longtime User
Can you say a few words about how it works?

Regarding the Sudoku itself, the processes involved are: image acquisition (in this case a recorded video), image pre-conditioning, grid detection, digit extraction and recognition, solver and drawing the results back.
For the grid recognition part, I made a mix of several existing posts. In this case, it uses Hough lines detection and some logic filters to remove duplicates and validate the grid only if there are enough lines for each group (vertical and horizontal), they keep similar distances between them, and other restrictions so that it can decide with enough confidence if it is a Sudoku grid or not.
Once detected, it calculates the line intersections, from where we get the outer corners, calculate the perspective and unwarp it. Then for each cell, we take the inner part, detect if there is something inside, and give it to a SVM which has been previously trained with the digits HOG features (a good compromise between speed and reliability in case of printed chars)
Once we have the 'predicted' digits, they are put in an array and given to a Sudoku solver module which uses a slightly modified backtracking algorithm that I found somewhere (there's also plenty of them in internet).

Since the solver can take a while, it uses a callback to notify the results. If the grid and the digits that are being detected at a given moment is still the same that has been passed to the solver, and that sudoku has been solved, it draws the solution in the cells of the unwarped image. Then we undo the unwarping and the final result is drawn.:)

Do you use a canvas to draw the openCV results?
Yes, the example uses a B4XCanvas to draw the corresponding Image to a Pane, scaling and all these things.
In order to get the B4J Image from the OCVMat, a 2-step conversion is necessary. First, the OCVMat is converted to a BufferedImage via an in-built-method of the OpenCV HighGui module, and then it is converted to a javafx.scene.image.Image via SwingFXUtils methods.
A similar process is made to get an OCVMat from an Image.
 

Eme Fibonacci

Well-Known Member
Licensed User
Longtime User
@JordiCP, thank you for the words. You are the best with openCV in this community.
I have a lot to learn.
Very interesting things can be done with openCV + B4J + arduino.
 

Cableguy

Expert
Licensed User
Longtime User
Regarding the Sudoku itself, the processes involved are: image acquisition (in this case a recorded video), image pre-conditioning, grid detection, digit extraction and recognition, solver and drawing the results back.
For the grid recognition part, I made a mix of several existing posts. In this case, it uses Hough lines detection and some logic filters to remove duplicates and validate the grid only if there are enough lines for each group (vertical and horizontal), they keep similar distances between them, and other restrictions so that it can decide with enough confidence if it is a Sudoku grid or not.
Once detected, it calculates the line intersections, from where we get the outer corners, calculate the perspective and unwarp it. Then for each cell, we take the inner part, detect if there is something inside, and give it to a SVM which has been previously trained with the digits HOG features (a good compromise between speed and reliability in case of printed chars)
Once we have the 'predicted' digits, they are put in an array and given to a Sudoku solver module which uses a slightly modified backtracking algorithm that I found somewhere (there's also plenty of them in internet).

Since the solver can take a while, it uses a callback to notify the results. If the grid and the digits that are being detected at a given moment is still the same that has been passed to the solver, and that sudoku has been solved, it draws the solution in the cells of the unwarped image. Then we undo the unwarping and the final result is drawn.:)


Yes, the example uses a B4XCanvas to draw the corresponding Image to a Pane, scaling and all these things.
In order to get the B4J Image from the OCVMat, a 2-step conversion is necessary. First, the OCVMat is converted to a BufferedImage via an in-built-method of the OpenCV HighGui module, and then it is converted to a javafx.scene.image.Image via SwingFXUtils methods.
A similar process is made to get an OCVMat from an Image.
That simple, Hugh???
Are you sure you're not French?
 
Top