Ask Your Question

I'am done my JAVAFX application with opencv,but processing is running slowly?

asked 2020-02-14 11:33:58 -0500

Yasemin gravatar image

Hello! I have a javafx application and I am using opencv lib. But I have a big problem, my application processing is running slowly.I do operations with pixel values ​​of the pictures By the way, I use 4 nested for loops( for 672 images).There are also multiple functions in loops. I removed all the unnecessary details and made the code the simplest. But it takes more than 1 hour to work!!

Thank you for your interests

edit retag flag offensive close merge delete


But it takes more than 1 hour to work!!


berak gravatar imageberak ( 2020-02-14 14:21:19 -0500 )edit

Yes, it took more than 1 hour to work. Why off-topic???

Yasemin gravatar imageYasemin ( 2020-02-14 14:23:44 -0500 )edit

Nobody can help you if you don't 1l tell what you do to the images, 2l show an example image and tell the generic properties of the images (size..) 3) show your code and 4) describe the running environment - a low memory system could spend its time swapping.

Note that you should be able to find out where exactly the time is spent. Java has functions for that.

mvuori gravatar imagemvuori ( 2020-02-14 14:26:02 -0500 )edit

it took more than 1 hour to work

doing what, btw ?

where's the problem ?

berak gravatar imageberak ( 2020-02-14 14:28:39 -0500 )edit

my question is not off-topic or something, it is a very opencv related situation. javafx can be a special detail. You might think as java, I didn't think it would be hard. As for the details, I access the pixel values ​​in the operations I do in the loops, and perform operations such as searching and changing depending on some conditions. the program runs very slowly in these for loops. In summary, the processes I deal with pixel values ​​are huge. my pixel values ​​are 16 bits

Yasemin gravatar imageYasemin ( 2020-02-14 14:41:19 -0500 )edit

there are 4 more functions like this, in the loops.

Yasemin gravatar imageYasemin ( 2020-02-14 14:49:55 -0500 )edit


  • edit your question, and put (the relevant part of) your code there (not into comments).
  • try to explain, what you try to achieve, and what it should do.

then we can try to help you using opencv's api better (NEVER write loops like that !)

berak gravatar imageberak ( 2020-02-15 03:32:29 -0500 )edit

When setup opencv, how can I do enable openblas(lapack)? Does anyone knows?

Yasemin gravatar imageYasemin ( 2020-02-17 00:53:26 -0500 )edit

1 answer

Sort by » oldest newest most voted

answered 2020-02-16 13:48:03 -0500

Yasemin gravatar image

updated 2020-02-16 14:38:42 -0500

LBerger gravatar image

Okey I understand, thank you:) I have to use nested 4 *for loops and my code part;

for(int i =lowpoint;i<(highpoint-1);i++) 

for(int j = i+1;i<highpoint;j++)

   for(int k = offpoint;k<highpoint;k++)


       for(int m=impoint;m<highpoint;m++){
          result2=function3(image, ver-size,hor_size,,result1[0],result1[1],m);
          sum = sum+result3[m];

all functions include operations related to the pixel values of the images except function2.

pixel values operations, for example;

**public  Mat [] Function(Mat[] imagearray, int ver_size, int hor_size, double doublenumber, int lowpoint, int highpoint, int offset_point){
    public static double[] colorspace1;
    public static double[] colorspace2;
    public static double[] colorspace3;
float [] colorspace_u=new float[1];
for(int i=0;i<ver_size;i++){
            for (int j=0;j<hor_size;j++){
                if (colorspace_u[0]>5){
                else if(colorspace_u[0]<0.2){
       return result;

//So other function's calculate like this.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2020-02-14 11:33:58 -0500

Seen: 94 times

Last updated: Feb 16 '20