I have been working on the problem of deblurring an image using GAN. My generator is an autoencoder which should take a blurry image as input and output a de-blurred image. The results are good but the reconstructed image is containing some weird pixels.
https://imgur.com/a/xQEnFsI The middle column in each image is my output. Can someone help me understand why am I getting those weird artifacts?
This is probably caused by overflow(underflow) if those pixels' RGB values are negative or over 255 (assuming 8 bits for each channel) after decoding. To solve that, simply overwrite those values with 0 and 255 before showing the images.
Related
Does it add to the image if too small or crop if too big or just stretch the image to the desired size?
When you set interpolation=2, then you are using Bilinear interpolation, ti can be either used for upsampling or down sampling. In the case of upsampling you are doing something like
There are several types of upsampling and down-sampling, but bilinear one uses a combination of the neighbouring pixels to cimpute the new pixel.
Look to this links for more informations: link1; link2
Resize stretches the image to span the new size. It samples from the original image using the provided interpolation method.
I have a binary itk image that I am trying to fill the holes using itk::BinaryFillholeImageFilter
using FillholeFilterType=itk::BinaryFillholeImageFilter<ImageType>;
FillholeFilterType::Pointer fillHoleFilter=FillholeFilterType::New();
fillHoleFilter->SetInput(someFilter->GetOutput());
fillHoleFilter->SetForegroundValue(itk::NumericTraits<PixelType>::max());
fillHoleFilter->Update();
However, it does not fill the holes. ImageType is float and its dimension is 3. How to solve this issue?
I ran SimpleITK.BinaryFillhole on your image, setting the foreground value to 1.0. Basically the same thing you did except the function version of the filter. It worked as expected.
The BinaryFillhole filter fills in holes that are contained completely within the object. In your case, there were some tiny, 1 pixel, holes that were filled in.
Maybe you were expecting some of the holes/junk along the object boundary to be filled. Because those holes are in some way (perhaps very small way) connected to the boundary, the filter does not fill those holes.
Perhaps you could try some smoothing of the image first.
BinaryFillholeImageFilter expects a binary image. Convert your image to itk::Image<unsigned char, 3> first, and then apply hole filling.
I need to have a graph in a specific format. I am using Gnuplot and try to use the size and terminal size to change the size of my output. However, Gnuplot does some really weird stuff and I don't know how to change things...
I am using Gnuplot Version 4.4 Patchlevel 3.
Here is a minimal example:
reset
set size 1
set terminal postscript enhanced color solid linewidth 1 size 15cm,10.5cm font "Helvetica" 16
set output "C:/..."
set encoding iso_8859_1 #for special characters
set xrange [2.05:3.13] #2. Achse
set yrange [1.5:2.1]
set border 3
set key spacing 1.5
set pointsize 0.6
plot '[...].dat' using 1:2 notitle with points pt 7 lc rgb "#000000" pointsize 1
that gets me the following output: http://i.stack.imgur.com/Z78gF.jpg
The graph is halved in size and starts in the middle of the canvas. I cannot change the position by using margins... I thought it might be a problem of size so I set set size 2 which then gave me http://i.stack.imgur.com/Ov5Ha.jpg . The graph still starts in the middle left and extends way over the boundaries, while most of the canvas stays white...
I have no idea what's going on and tried all kinds of stuff, but still, the picture won't start in the bottom left corner but somewhere in the middle, being shrinked in size... Somebody had the same problem?
I just want to get a Gnuplot figure of the size 15 cm x 10.5 cm - it can't be that difficult, can it be?
Thanks a lot!
After some messing aroung with gsview and gnuplot I found a solution that works for me that includes basically 4 steps:
1) use eps or even postscript, it doesn't really matter. Do not use the set size command. I used eps and it looks very good, here is one proposition:
set terminal postscript eps enhanced color solid linewidth 1 size 15cm,10.5cm font "Helvetica" 22
leave the ret as it was and go to
2) GSView: First check "Options - Show Bounding Box".
Use the commands under "Orientation" to orient canvas and figure so they match each other. This is usually landscape!
Now enter "Media - User Defined" to create a canvas that fits your needs. My figure is 15 by 10.5 cm and my canvas needed to be something like 17 by 12.5 cm.
3) Use b, t, l and r margins to move your figure on the canvas.
4) convert to pdf and take a look at the pdf if it matches your expectations.
I hope this is helpful for some people! It's probably quite a workaround but doesn't take so much time. Maybe it's not very helpful for automatisation...
I recently made a game with game maker and I've tried converting it to html5, but it's got some big errors... here is the game in html format: http://ivatrix.com/Game/index.html
First off, text is meant to appear in the top left like how you can see in this screenshot: http://gyazo.com/baa386fe06cfac9439c83b6e5192efd8 the text only appears after you create a combo.
Secondly, when you click on an orb it's meant to scale down to half it's size then scale up to 1.5x it's size, but instead it's shrinking until it's 1px large then infinitely increasing in size. Draw code is here:
if sl=1
{
if (s=0.6 or s=1) then d=d*(-1)
s+=d
if(frozen=1)
{
draw_sprite_ext(sprite_index,global.skin,x,y,s,s,0,c_blue,1)
}
}
And then there's other small errors like some text won't display, particle effects don't seem to draw, the game always returns saying there is no match on the board. That's all I've found so far.
Does anyone have any idea what I can do to fix this?
Thanks.
Since no one has provided an answer and I've found one myself, I'll put it up here so others in the same boat can benefit as well. Practically, the source of all my problems with floating point numbers being irregular, for example instead of it being 1 it could be 1.000000003, which meant if you were to check if that variable was equal to one, it would return false. Further information here: http://help.yoyogames.com/entries/77891197-HTML5-Issues-And-Differences
So for an example in my case, I changed the line
if (s=0.6 or s=1) then d=d*(-1)
to
if (s<0.6 or s>1) then d=d*(-1)
And now the problem is fixed.
I did an thinning operation on vessels, and now I'm trying to reconstruct it.
How to expand them to normal vessels in ITK when I have a skeleton line and radius values for each pixel?
DISCLAIMER: This could be slow, but since no other answer has been suggested, here you go.
Since your question does not indicate this, I'm assuming that you're talking about a 2D image, but the following approach can be extended for 3D too. This is how I'd go about it:
Create a blank image with zero filled pixel values
Create multiple instances of disk/sphere ShapedNeighborhoodIterator each having a different radius on the blank image (choose the most common radii from the vessel width histogram).
Visit each pixel in the binary skeleton image. When you come upon a white (vessel skeleton) pixel, recollect the vessel radius at that pixel.
If you already have a ShapedNeighborhoodIterator for that radius value, take the iterator to the pixel location in the blank image and fill up a disk/sphere of white pixels centered about that pixel. If you don't have a ShapedNeighborhoodIterator for that radius value, create one and do the same operation.
Once you finish iterating over the skeletonized image, you will have a reconstructed tree in the other image. Note that step 2 is optional, but will help you achieve faster computation.