Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
My task is recognition a lightning on the picture. I have chosen to use OpenCV.
I'm using binary tresholding to get image like this.
Original:
After binary thresholding:
How now to determine whether there is lightning in the image?
So, how to distinguish lightning on the image from other lines? For example
on this image after binary tresholding i have got the following:
but if i just count the number of white pixels - i get a wrong answer.
Main part of my code:
if ((Igray = cvLoadImage(argv[1], CV_LOAD_IMAGE_GRAYSCALE)) == 0) {
return -1;
}
int block_size = atoi(argv[2]);
double offset = (double)atof(argv[3]);
Iat = cvCreateImage(cvSize(Igray -> width, Igray -> height), IPL_DEPTH_8U, 1);
// treshold
cvThreshold(Igray, Iat, offset, 255, CV_THRESH_BINARY);
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
Need to draw a custom world map drawing either the complete world map or a certain region. Also highlighting different regions with different colours.
I have tried https://github.com/KiloKilo/WorldMatrix. I am able to colour the regions but unable to draw custom regions and provide custom colour to certain regions. Unable to find any other library.
Using below code, it shows nothing
let generator = WorldMatrixGenerator()
// Set the number of columns per rows (Default: 100)
generator.columns = 20
// Set your desired map cutting (Default: .world)
// use .custom(north, east, south, west) for a custom bounding
generator.mapCutting = .europe
// Set the output type (.enum, .ascii, .emoji) (Default: .enum)
generator.exportType = .enum
// Generates the world array
generator.generate()
Basically want to achieve the one in the image. Can someone let me know how can draw custom regions?
Thanks for the help in advance.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
What is the most efficient way to find the quadrant of an angle given in Objective-C (assuming that the boundary angles 0, 90, 270, 360 etc. all fall within a quadrant) ?
You don't need any magic functions.
Full circle contains 2*Pi radians and 4 quadrants.
So just divide angle by Pi/2 and make floor rounding to get 0..3 quadrant numbering (add 1 if 1..4 is needed)
Python example. Note that integer modulo operation % 4 provides "angle normalisation" so function works with large and negative angles
(Swift % does not work similar according to table here, so you might need to make something like return ((floor(2.0 * angle / math.pi) % 4 + 4) %4)
import math
def quadrant(angle):
return math.floor(2.0 * angle / math.pi) % 4
print(quadrant(math.pi/4))
print(quadrant(math.pi/4 + math.pi))
print(quadrant(math.pi/4 - math.pi))
0
2
2
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
Hey I was trying solve this problem . Where you're asked to segment out "zebra" out of image. Below is the given image.
And output should be like this.
Well I got stuck at "strips" of zebra cause they may get segmented as separate objects.
In image processing, it is important to look at your image and try to understand the difference between your region of interest, i.e. the zebra, and the rest, i.e. background.
In this example, a clear difference is that the background is rather greenish and the zebra black and white. Therefore, the green channel of the image can be used to extract the background. Afterwards the result can be (non-linearly) cleaned up using some dilation and erosion steps.
A simple and non-perfect segmentation technique is (in Matlab):
I = imread('lA196m.jpg');
% plot the original image
figure
subplot(2,2,1)
imshow(I)
% calculate the green channel (relative green value)
greenChannel = double(I(:,:, 2))./mean(I(:,:,:), 3);
binary = greenChannel > 1; % apply a thresshold
subplot(2,2,2)
imshow(binary);
% remove false positives (backgrounds)
se1 = strel('sphere',20);
binary2 = imdilate(imerode(binary,se1), se1);
subplot(2,2,3)
imshow(binary2);
% add false negatives
se2 = strel('sphere',10);
binary3 = imerode(imdilate(binary2,se2), se2);
subplot(2,2,4)
imshow(binary3);
% calculate & plot the boundary on the original image
subplot(2,2,1)
Bs = bwboundaries(~binary3);
B = Bs{1};
hold on
plot(B(:, 2), B(:, 1), 'LineWidth', 2);
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
i am working on a project where i need a reference image like this
say if want to create a image using Opencv with particular -width -hight
and certain number for horizontal(x) & vertical(y) line to be created evenly
You can create an image of a particular size using the Mat constructor:
cv::Mat::Mat ( Size size, int type )
This is an overloaded member function, provided for convenience. It
differs from the above function only in what argument(s) it accepts.
Parameters
size 2D array size: Size(cols, rows) . In the Size() constructor, the number of rows and the number of columns go in the reverse order.
type Array type. Use CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or CV_8UC(n), ..., CV_64FC(n) to create multi-channel (up to
CV_CN_MAX channels) matrices.
and you can draw lines on images (Mats) using the line method:
C++: void line(Mat& img, Point pt1, Point pt2, const Scalar& color, int thickness=1, int lineType=8, int shift=0)
Some example code to create an image with a line in would be:
cv::Mat myImage=cv::Mat::zeros(cv::Size(10,10), CV_8UC1);
line(myImage, cv::Point(5,5), cv::point(10,10), cv::Scalar::all(255));
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I want to display 3 images in a single row. Each image having thumbnail class. Column width is .col-xs-2. I can have the last row just having one/two/three images depending upon total images(say 7). I want to have a ruby while/for loop which will automate this and do it.
eg. x|x|x
x|x|x
x|
here x represent the images which are of thumbnail class. Inside col-xs-2 class.
I want to display 3 images in a single row
You need Enumerable#each_slice. This will divide your images in equal numbers. You can do
- #images.each_slice(3).each do |group|
// #images is an array of images
- group.each do |image|
// image is a single image in your array of 3 images
.image-container
= image_tag(image.url, class: "col-xs-2")