Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I want to get lat long of rectangle in format "[51.49, -0.1], [51.48, -0.06]" means only diagonal lat long.
I am using getLatLngs(). It gives all four co-ordinates of rectangle.
if (type === 'rectangle') {
pt = layer.getLatLngs();
}
You can use getLatLngs():
var latLngs = rect.getLatLngs();
var diagonal = [latLngs[1], latLngs[3]];
or you can use getBounds():
var bounds = rect.getBounds();
var diagonal = [bounds.getNorthWest(), bounds.getSouthEast()];
Related
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 2 years ago.
Improve this question
I have Two Offset to draw Line using Custom Painter, i need to check these offsets are in straight line (horizontally). how do i check? If not it is not in a straight line, how to change offset.
Two lines are horizontally straight if they share the same dy property.
To check if they are the same you can do:
Offset o1 = ...;
Offset o2 = ...;
if(o1.dy == o2.dy) {
// horizontal line
}
else {
// not horizontal
}
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 2 years ago.
Improve this question
clc;clear all;
Imatrix = []
for i=1:3
images{i} = imread(sprintf('frame-1065.png',i));
Imatrix = cat(3, Imatrix, images{i});
D = Imatrix;
end;
imshow(D)
This is the code I'm trying to run but the problem is I have 2000 pictures and I am only able to get one to be displayed.
I think what you really want is to store the images as image stacks.
This will allow you to view the image stack in e.g. ImageJ and scroll through it etc.
I would store them as one single tiff file and do something like this (please note that all your images must be of the same size):
numOfImages = 2000;
output_filename = 'imgstack.tif';
for k=1:numOfImages
loaded_image = imread(sprintf('frame-%d.png',k));
imwrite(loaded_image, output_filename, 'WriteMode',append','Compression','none');
end
The issue is visualization. You can view either an MxNxP stack or a cell array where each cell represents an image using the montage function.
https://www.mathworks.com/help/images/ref/montage.html
figure, montage(images)
In your code above.
If you want to visualize your data as a volume, which you've indicated in the most recent comment, then volshow or volumeViewer in IPT will do that.
volumeViewer(Imatrix)
figure, volshow(Imatrix)
Where Imatrix is an MxNxP array that you want to perform volume visualization on.
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 8 years ago.
Improve this question
I have an image which I have converted to a binary mask.
My regions of interest are those with 1 in the mask.
I want to find the coordinates of these regions,
and go to the original image (same dimensions) so I can crop the unprocessed part of the image.
You can use this answer to get a bounding box from your binary mask.
Once you have the bounding box (rect variable in the aforementioned answer) you can use imcrop to crop the original image around it
cIm = imcrop( origImg, rect );
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 8 years ago.
Improve this question
I have an image (620x1024), that I want to turn into a same sized image of equally luminous red. What do?
Is this the type of thing you're looking for?
function h = redifyImage(fname, luminosity)
img = imread(fname);
img(:,:,2:3) = 0;
img(:,:,1) = luminosity;
h = image(img);
end
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 am doing an image processing project. In my project there is an GUI file that reads an image and processing it for segmentation. while reading an image file, initially it is checking the size of that image... However, I don't understand what the function I=[m x n x 4] really means. Could someone explain this to me?
Your image I is of size m pixels high by n pixels wide and has 4 channels: Red, Green, Blue and an alpha channel.
Matlab stores I as a 3D array, you can access the x-y-th pixel by I(y,x,:) returning the four-vector representing the RGBA value of the x-y-th pixel.