I am trying to implement a hough transform in Java to find all lines in an image. Since the process itself took too much time, I decided to spread it across multiple threads. However, after doing that, the process didn't become much faster. What am I doing wrong? Is the reason that the for
loop is waiting for the input_elements
to complete on each iteration?
for
loop
latch = new CountDownLatch(thread_arr.length);
for (int i=0; i<border_que.arr.length; i++) {
thread_arr[i].input_elements(border_que.arr[i][0], border_que.arr[i][1]);
}
try {
latch.await();
} catch (Exception e) {System.out.println(e.getCause());}
Thread Code
class RowAndThetaThread implements Runnable{
private int x_0;
private int y_0;
public void run() {
// find rho and theta and push them to an array
}
public void input_elements(int x, int y) {
x_0 = x;
y_0 = y;
this.run();
}
}