You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The greyscale version looks for the sequence of black lines stacked on top of a white background that will most closely approximate the original image. The color version separate the image into channels and repeats this for each channel.
For example, suppose I have black AND white lines on a grey background.
When the lines are to be combined in the finished image, I want to add line A to stack B.
Some white might be on top of some black and vice versa. Note that it might not be strictly white-black-white-black-etc.
Lines are not woven together - a new white string cannot be under previous white strings.
It is a convenient property that two lines only cross at a single point.
The test "is line A better on top of topmost-B?" is pretty quick to calculate... but wrong.
Sometimes the answer is indeterminate (lines are parallel, non-intersecting, or equal better-ness).
Sometimes it would be better to put A under some B lines, because the total error is lower than A being above all B. eg, some error might be permissible. How much? I don't know. Aye, that's the rub.
The text was updated successfully, but these errors were encountered:
imagem de tons de cinza para RGB
Mat rgbImage = new Mat();
Imgproc.cvtColor(grayImage, rgbImage, Imgproc.COLOR_GRAY2RGB);
// Desenha as linhas na imagem original
for (int i = 0; i < lines.rows(); i++) {
double rho = lines.get(i, 0)[0];
double theta = lines.get(i, 0)[1];
double a = Math.cos(theta);
double b = Math.sin(theta);
double x0 = a * rho;
double y0 = b * rho;
Point pt1 = new Point(Math.round(x0 + 1000*(-b)), Math.round(y0 + 1000*a));
Point pt2 = new Point(Math.round(x0 - 1000*(-b)), Math.round(y0 - 1000*a));
Imgproc.line(rgbImage, pt1, pt2, new Scalar(0, 0, 255), 3);
}
// Mostra a imagem com as linhas detectadas
Imgcodecs.imwrite("path/to/output/image.jpg", rgbImage);
}
}
This is a simple example of image processing using the OpenCV library in Java. The code loads an image, converts it to grayscale, segments it using thresholding, detects lines using the Hough transform, converts the grayscale image to RGB, draws the detected lines on the original image, and saves the output image to a file.
The greyscale version looks for the sequence of black lines stacked on top of a white background that will most closely approximate the original image. The color version separate the image into channels and repeats this for each channel.
For example, suppose I have black AND white lines on a grey background.
When the lines are to be combined in the finished image, I want to add line A to stack B.
Some white might be on top of some black and vice versa. Note that it might not be strictly white-black-white-black-etc.
Lines are not woven together - a new white string cannot be under previous white strings.
It is a convenient property that two lines only cross at a single point.
The test "is line A better on top of topmost-B?" is pretty quick to calculate... but wrong.
Sometimes the answer is indeterminate (lines are parallel, non-intersecting, or equal better-ness).
Sometimes it would be better to put A under some B lines, because the total error is lower than A being above all B. eg, some error might be permissible. How much? I don't know. Aye, that's the rub.
The text was updated successfully, but these errors were encountered: