Netlogo - Graphics window grows every time model is opened (patch size < 1) - netlogo

In Netlogo, I have to change the patch size to <1 in order to fit the graphics window on my computer screen. For example, from 1 to 0.5.
This works well; however, once I save the file, close it, and reopen, the graphics window (not coordinates - but the physical size of the window on my computer) is back to its previous size.
When I check the patch size however, it is still 0.5. Now for my model to fit, I must make the patch 0.25. This is a cycle, and I eventually need to make the patch size ridiculously small like 0.001.
I am using Netlogo 6.1.1 and have only used the Model Settings Box to modify patch size. I have attached screenshots of this behavior :
I understand that the patch size does not affect the model functionality, however, I would like to fix this so that the model is presentable.
Has anyone run into this issue, or has any idea of how to avoid/fix it?
Any suggestions are welcome!

This is a known NetLogo issue, and it would probably be rather difficult for the NetLogo developers to fix it. (I know, I used to be one of them.)
Details are here: https://github.com/NetLogo/NetLogo/issues/409

Related

Image processing/restoration in Matlab

I have several images that i would like to correct from artifacts. They show different animals but they appear to look like they were folded (look at the image attached). The folds are straight and they go through the wings as well, they are just hard to see but they are there. I would like to remove the folds but at the same time preserve the information from the picture (structure and color of the wings).
I am using MATLAB right now and i have tried several methods but nothing seems to work.
Initially i tried to see if i can see anything by using an FFT but i do not see a structure in the spectrum that i can remove. I tried to use several edge detection methods (like Sobel, etc) but the problem is that the edge detection always finds the edges of the wings (because they are stronger)
rather than the straight lines. I was wondering if anyone has any ideas about how to proceed with this problem? I am not attaching any code because none of the methods i have tried (and described) are working.
Thank you for the help in advance.
I'll leave this bit here for anyone that knows how to erase those lines without affecting the quality of the image:
a = imread('https://i.stack.imgur.com/WpFAA.jpg');
b = abs(diff(a,1,2));
b = max(b,[],3);
c = imerode(b,strel('rectangle',[200,1]));
I think you should use a 2-dimensional Fast Fourier Transform
It might be easier to first use GIMP / Photoshop if a filter can resolve it.
I'm guessing the CC sensor got broken (it looks to good for old scanner problems). Maybe an electric distortion while it was reading the camera sensor. Such signals in theory have a repeating nature.
I dont think this was caused by a wrong colordepth/colorspace translation
If you like to code, then you might also write a custom pixel based filter in which you take x vertical pixels (say 20 or so) compare them to the next vertical row of 20 pixels. Compare against HSL (L lightnes), not RGB.
From all pixels calculate brightness changes this way.
Then per pixel check H (heu) is within range of nearby pixels take slope average of their brightness(ea take 30 pixels horizontal, calculate average brightnes of first 10 and last 10 pixels apply that brightness to center pixel 15,... //30, 15, 10 try to find what works well
Since you have whole strokes that apear brighter/darker such filter would smooth that effect out, the difficulty is to remain other patterns (the wings are less distorted), knowing what color space the sensor had might allow for a better decision as HSL, maybe HSV or so..

Unity3D: stack of thin boxes toppling despite perfect alignment

Here is what happens when I copy&paste a few thin boxes, and then vertex-snap them to the ground and each other:
Pressing "Play" leads to the stack toppling.
I tried reducing the BoxCollider y to 0.99 and 0.95. No luck still.
Does anyone have recommendations to easily get a stacked wall to just stay up (until a real force is applied)? Maybe there is some sort of "glue" component to prevent two faces separating until a force exceeds some threshold?
Try setting their positions manually so that they are right under each other.
You shouldn't expect to be able to make a stack of 20-30 box colliders stacked on their smaller faces because of physics simulation inaccuracies, floating point errors and so on. If that's your intention and/or the above doesn't work, try using Fixed Joints with a manually set Break Force and/or Break Torque.
You can also try increasing the Solver Iteration Count to something like 10 or 15 (which should do the trick in most cases), but it won't be good for performance in scenes with 1000s of objects.
Increasing the Sleep Threshold will also help in this specific case, but can cause problems like small objects sleeping when they have small (but not infinitesimal) velocities.
EDIT:
A similar thing happens with my own custom physics engine. Another workaround you can do is to align the bodies and set them to sleep in Start. That way they'll stay upright (not moving rather) and topple when something collides with them.

How to increase the dataset?

I am doing a project on face recognition. I have a dataset containing image of 21 actors(each 150). Now I want to increase the no. of image of each actor to 300+ for the training purpose. How can I do it using MATLAB. Some solutions can be we can vary the contrast/brightness level of each image. But what are some other factors through which I can increase the no. of images.
One option is for you to flip the images: If a person is looking to the right, after the flip he will be looking to the left.
Further more, depending on your possible toolkit and set of skills, you could do some more advanced technique. If you can find some interesting characteristic from the pictures, like: eyes, nose, mouth, background. With those, you could make some intelligent transformations - swap peoples eyes, change the background, switch noses.
There are some particular objects of the faces which you could also distort - like the eyes and nose - stretch them. Maybe for bold guys you could built some synthetic hair, and so on...
You could do the contrast/brightness level change, but usually it doesn't do so well, as your features probably doesn't have (almost) anything to do with it, so it will just be a duplication of your data.
Anyway, as it's not a very large data set, if you don't have the set of skills to pull the more advances options I proposed, or the time to deal with it, you can make some of those stuff manually. It won't take you as much as you think. And usually, with that amount of data, this will give a good boost to your results.
What you are looking for is called "data augmentation". Common transformations are mirroring (flipping left / right side of the image) and rotation of the image. You might also be able to zoom (crop) a part of the image.
Maybe scaled versions with the rotated ones may help. If your features are not robust to the changes such as lightning contras etc you can modfy the images accordingly.

NetLogo Dimensions In Space

1.How does the coordinate system in NetLogo shape in terms of "cms" as horizontal coordinate(cm) and vertical coordinate(cm)?(The settings tab sure does give in pixels but I unfortunately don't know the conversion between pixels and cms)
2.How does turtle size correlate with or is specified in pixels?
UPDATE.
Is there any possible way given my screen resolution I can accomplish the above conversion?
I found some links http://www.unitconversion.org/typography/pixels-x-to-centimeters-conversion.html claiming to do the above I don't know regarding their crediblity
1.How does the coordinate system in Netlogo shape in terms of "cms" as horizontal coordinate(cm) and vertical coordinate(cm)?(The settings tab sure does give in pixels but I unfortunately don't know the conversion between pixels and cms)
It doesn't. There is no general conversion between pixels and centimeters, nor should there be. The physical size of a pixel depends on your screen size and resolution. For the purpose of a model, you can always decide that, e.g., 10 pixels represent 1cm, but this would have no correlation to actual physical size on screen.
2.How does turtle size correlate with or is specified in pixels?
Ah! This one actually has an answer: a turtle of size 1.0 is the same size as a patch, and patch-size gives you the size of a patch in pixels. The size of a turtle in pixels is thus size * patch-size. Note, however, that this is the size of the side of the square occupied by the turtle; not the actual area of the shape displayed on the screen.
Is there any possible way given my screen resolution I can accomplish the above conversion?
This depends not only on the resolution of the monitor, but the monitor itself. For instance, if your monitor is 1440x900 and you project up on a screen, or plug into an external monitor that scales the output, obviously the pixels-per-cm is going change dramatically, even though the resolution stays the same. Even within the same monitor, this can change. For instance, many modern laptops (notably macbook pros) have so called hi-dpi screens with huge resolutions. Applications on the screens can be run in scaled or non-scaled formats, which completely changes the pixels-per-cm (e.g. NetLogo 5.0.5 ran in scaled-mode on OS X, but 5.1 runs in non-scaled-mode; you'll notice that the text on retina screens looks considerably sharper and less pixelated). Even just in netlogo, you can zoom in and out, which changes the scale of all the elements (see the zoom menu).
So, the only way to determine the pixels-per-cm is for a specific application on a specific monitor running under a specific resolution with specific settings. In that case, your best bet for measuring the size of patches and turtles is probably a ruler. You can probably find some applications that give you a "screen ruler", but the only trustworthy ones I'm aware give the answer in pixels, and I probably wouldn't trust anything that claims to give cm.
I think you're having trouble getting the answer you want here because, in some sense, the question doesn't really make sense. The measurement of patches in cm can always be changed at will and will always change depending on environment. So perhaps the best answer to your first question is "whatever you want it to be".

Matlab: Track point on object in video

I would like to track (if that is the right word for this) the movement of a point on an object and return the co-ordinates for the point in each frame to arrays for plotting. How would you go about doing this?
The point on the video is a certain color and so my first effort was to eliminate all other colors and change the part I wish to follow to black and everything else to white. Doing this left me with some areas in the background which are the same color but I wish to ignore them and just focus on the moving point. I do not know where to even begin with this or if I've even been trying to do the right thing so far?
Any help would be greatly appreciated! :)
Try searching for terms like 'tracking', 'morphological', 'computer vision', 'matlab'
Here's a project that I found that will probably get you started.
http://www.mathworks.com/matlabcentral/fileexchange/28757-tracking-red-color-objects-using-matlab
if your object of interests is of a certain specific color. You can always apply a color-filter. To give you a bit of a background, i was trying to track not a point on an object, but a moving object in one of the videos i have. (it was a ping-pong video and my goal was to track the ping-pong ball). My algorithm was simple and fast (as i did not want any of my filters to induce heavy computations at one single frame). The basic idea was to apply a color filter. Similar to other shape filters, if your target is of high similarity to the filter, the response will be distinctive enough for you to notice. In other words, if you minus two objects that are extremely similar, you will get 0, otherwise, it will be far greater than 0.