B4A Library OpenCV 3.x

cesarcm

Member
Licensed User
Hi JordiCP,

How are you doing?

Please, one more question... yep! I am late :(


Private Sub List2Array3D(lst As List) As Object(,)
Dim rgb(3) As Double
Dim arr(lst.Size, 3) As Double

For i=0 To (lst.Size - 1)
rgb = lst.Get(i)
arr(i, 0) = rgb(0) : arr(i, 1) = rgb(1) : arr(i, 2) = rgb(2)
Next

return arr
End Sub


Dim mySignal As List
'PS: each list row contains an array regarding RGB colors

Dim outSignal As OCVMat
outSignal.Initialize2(mySignal.Size, 1, mType.CV_32FC3)

Dim arr(mySignal, 3) As Object = List2Array3D(mySignal)

outSignal.put(0, 0, arr) ???


'PS: how to put the array into OCVMat with PUT method???


Any idea?
Thanks.
Regards,
Cesar
 

cesarcm

Member
Licensed User
JCP and Erel,

Running your JordiCP's OpenCV code at "old" Activity model I was getting ~12fps (Motorola One Vision) ...

Now, using B4Xpages I am getting ~6-7fps :(

Any idea? Probably it is related to Erel's implementations of B4XPages ... or not?

Thanks.
Regards,
Cesar
 

cesarcm

Member
Licensed User
Erel,

Thanks but something is different ...

I have sent to JordiCP:


JCP,

I have tried -- using B4XPages -- both commands below:

mOpenCvCameraView.connectCamera2(pnlView, True) ' NEW

'mOpenCvCameraView.connectCamera(pnlView.Width,pnlView.Height)


No processing at all .. just to capture video frames => 9-10fps !!! (of course, after apply the algorithms it decreases to 5-6fps)

It means that using your original OpenCV library or the new one the FPS are the same ...

I will try using the same algorithm at the old Activuty project ...

Thanks.
Regards,
Cesar
 

cesarcm

Member
Licensed User
Erel,

I just have tested here again! Results below:

JCP,

Using your lib in "old standard" project: ACTIVITY

1) just grabbing video frame: 22-23fps

2) applying face detection: 10-11fps

3) full algorithm (from our project): 9-10fps

Weird ... it means that your LIB + our algorithms under B4XPages are 50% slower than the "old" Activity model ...

Thanks.
Regards,

Cesar
 

cesarcm

Member
Licensed User
Erel and JordiCP,

Running in RELEASE MODE we get 25fps !!! :D:p:);):cool:

Why so difference to DEBUG mode??? and why in debug mode there are almost 50% differences between Activity vs B4XPages projects ?

Thanks for all ;)
Kind regards,
Cesar
 

JordiCP

Well-Known Member
Licensed User
JavaCameraView uses a different thread in release mode, and the same UI thread in debug mode. I needed to do it this way to make it work in debug mode.

Besides, debug mode is optimized for a faster development/deployment cycle, where part of the code can be executed in the device and another part in the pc. That's why performance should ALWAYS be measured in release mode.

So, if everything is fast enough in release mode, you got it :)
 

Erel

Administrator
Staff member
Licensed User
and why in debug mode there are almost 50% differences between Activity vs B4XPages projects ?
It has nothing to do with B4XPages.
As I've already wrote it two times, I will write again:
It has nothing to do with B4XPages.

Clean the project, remove breakpoints and it will run in the same speed. The debugger is very complex and has several execution pipelines that depend on all kinds of parameters.
Bottom line is to never test performance in debug mode.
 

cesarcm

Member
Licensed User
Erel,

Thanks a lot! YOU ROCK!

Please, accept my apologizes since you had to write 3x about B4XPages.

I just would like to understand what is the performance differences between Activity models under debug mode... It was making non sense when I was testing. Sorry about that.

Kind regards,
Cesar
 

PodSoft2016

Member
JavaCameraView uses a different thread in release mode, and the same UI thread in debug mode. I needed to do it this way to make it work in debug mode.

Besides, debug mode is optimized for a faster development/deployment cycle, where part of the code can be executed in the device and another part in the pc. That's why performance should ALWAYS be measured in release mode.

So, if everything is fast enough in release mode, you got it :)
Hello, i'm sorry sir for my question. can you help me about detecting face parts such as mouth, nose or ear in this library?
Thanks alot .
 
Top