how to load a stack of images on matlab [closed] - arrays

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 have 170 png images in a folder.
I want to load and store them in a matrix/array/cell array, so that i can easily access and modify them but I'm stuck at the very beginning.
How can I do it? Which is the best structure?

Assuming they are all the same size, in the folder containing the images:
list=dir('*.png'); % read all the .pngs in your folder
Image1=imread(list(1).name); % read the first image to calculate the dimentions of your stack
ImSize=size(Image1)
ImageStack=zeros(ImSize(1),ImSize(2),length(list)); % preallocate your stack with zeros
for ii=1:length(list)
Image=imread(list(ii).name
ImageStack(:,:,ii)=rgb2gray(Image); % copy an image in each step of the third dimsion of your stack
end
If you need the color information just add another dimension to ImageStack and forget the rgb2gray(). Hope that helps!

Related

How to add new element to const char ** array [closed]

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 1 year ago.
Improve this question
What's up?
I am very interested in the question of how to add a new element to my array
uint32 glfw_extension_count = 0;
const char** glfw_extensions;
glfw_extensions = glfwGetRequiredInstanceExtensions(&glfw_extension_count);
return glfw_extensions;
I just need add to 'glfw_extensions' VK_EXT_DEBUG_UTILS_EXTENSION_NAME
The (great!) documentation says:
Pointer lifetime
The returned array is allocated and freed by GLFW. You should not free it yourself. It is guaranteed to be valid only until the library is terminated.
So clearly you can't do the necessary re-allocation. So you must allocate a new array, copy the data in, and then append your additional entry. I would assume that you can safely copy the string pointers themselves, didn't see a lot of discussion about that in the documentation page so it might need further verification.

How can I write an array of arraylist in the uml? [closed]

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
This is my array of arraylist: Arraylist[] a = new Arraylist[SIZE];
I’m struggling with writing it in my UML diagram, how can I write it?
With or without the <>?
The simplest way is to define it this way:
a is of type Arraylist (after the colon) with multiplicity 0..* and its default (after the equal sign) is Arraylist[SIZE].
As commented by #bruno the default value is a bit of interpretation. UML basically should be held language agnostic, but sometimes you just want to point out implementation details (for whatever reason). So you can add the new keyword right in front of the Arraylist[SIZE]. What that actually means is language dependent (and so out of a general scope I like to stick to).

Azure Maps - How to increase the max text size/avoid word wrap? [closed]

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
When I create a symbol layer the text field is wrapped if the text becomes too long. I'm not able to figure out why/when the text is to long. It seems to depend on different things e.g. font type, text size and text length.
I tested the text length by using this example code. I replace Cafeteria with the alphabet with space between each character. It then wraps to a second line between m and n and that's to few letters on one line for our use case. https://azuremapscodesamples.azurewebsites.net/Symbol%20Layer/Formatted%20text%20field.html
I have been working with mapbox. They have a setting "text-max-width" that solves this issue.
I have checked the javascript code that comes with the npm package azure-maps-control and it doesn't implement support for "text-max-width".
Do anyone know how to fix the wrapping issue or if the package azure-maps-control are going to implement support for the "text-max-width" setting?
There is no option for this today, but I've added it to the feature request list. As a work around, you could do the following:
var layer = new atlas.layer.SymbolLayer(datasource);
map.map.setPaintProperty(layer.getId(), 'text-max-width', 15);

Model 3D spring from points [closed]

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
I have generated points like this and now I what to connect all these points into one model - spring. How can I achieve this? I've tried iterating through each point and build it from polygons or triangles but I have failed.
I have set of rings where each ring was build from points which coords I have.
You probably want to treat these as generalized cylinders and tessellate a triangle mesh. This can be done by sweeping a circle along the path. Some of the details are tricky since undefined tangents can lead to unexpected twists in your triangle mesh. You might want to study the GLE library or the TubeGeometry implementation in ThreeJS.
For simplestic rendering, note that OpenGL has GL_LINE_STRIP. It also has glLineWidth, although many platforms have a max width of 1. You would need to take care to use separate draw calls for seperate springs, otherwise they'll be connected.

Removing Background and Detect shape With C program [closed]

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
I want to remove background and detect the shape of the egg from the picture and calculate the oval shape. What would be the best approach for this, I want do it with C.
Thanks in advance.
You can extract exact oval shape by trying following algorithm:
Extract Red Channel from image. It will look as follows:
Apply threshold and suppress all pixel values below 150. It will give you exact oval shape as below:
I have written code for this in C++. Following is the function I used for shape extraction:
int main() {
cv::Mat input = imread("image.jpg");
cv::Mat im_splt[3];
split(input, im_splt);
cv::Mat RedChannel = im_splt[2];
cv::Mat OvalShape = RedChannel > 150;
}

Resources