I had a problem where I had an input image like this :
And I had to remove that sharp contrasting horizontal line in the image forehead as can been.
So tried blurring, filtering etc but nothing worked. So finally I used seamless cloning. And I got the result like this :
This pretty much solved my problem. But if you go through the documentation and this tutorial, the parameters for seamless cloning is explained properly.
There we have a srcImage which is cloned to another destinationImage. For my problem, I took the srcImage as completely white and of the rectangle around the sharp line. (Below is the white image, hold the cursor around to see).
So my problem is how did this even work, as in any other image if I have instead of the white image it throws me a fatal error. Why did it work only with white image?
Related
I'm using Hugging Face's DPT large to compute depth map.
Here is an example of my problem:
(credit: museum of GenĂªve)
The depth map contains some little white lines just above the mountains in the background.
How can I avoid them ?
btw: I have cloned the repo and it works well on my local computer, so I have access to the code. I can make pre/post-processing. But as non-specialist I cannot patch Midas itself.
EDIT: I'm using Midas exactly as in the example: https://huggingface.co/spaces/akhaliq/DPT-Large/blob/main/app.py By the way, the effect I describe is visible in the offical demo.
EDIT: when I feed the extractor with the original 1148x790 image, the issue does not appears. It appears with a resized image 600x413. Thus a solution could be to only use non resized images.
Answer to myself.
It turns out that the issue disappears with:
Using the model "DPT_BEiT_L_512"
transform = midas_transforms.dpt_transform
prediction = torch.nn.functional.interpolate(
prediction.unsqueeze(1),
size=img.shape[:2],
mode="bilinear", # <--- instead of bicubic
antialias=True,
align_corners=True,
The above pic (looks like zoomed one ) is from first level conversion from 1.Ai file 1_cropped.AI file what I get after cropping. I don't do resize during cropping it gets automatically resized.
I am trying crop an image, Seems without +repage imagemagick unable to crop. The problem is a simple crop created the jagged lines as you can see from the snapshot taken from a portion of image.
How to remove this. Some where in SOF post I found a recommendation to use "Gaussian blur" but didn't find a proper command to do the same. Many thanks! I am doing just the crop and no resizing.
Original : Due to copyright can't show the entire image. But below is one section:
Looking into : http://www.imagemagick.org/Usage/antialiasing/ now but unable to smoothe the 'stair case' or 'jaggies' so far.
UPDATE from the comments:
Yes the input is AI and output is almost all format AI/SVG/PNG/GIF/JPEG/BMP. So for smaller resolution files such as png/GIF I don't get that jagged shapes I I tried turning on anti-aliasing , blurring and guassian-bluring but no luck. I think the repaging zooms the image which I don't need, is it possible to set the canvas somehow so the original resolution is kept intact when converting from AI to AI? Yes initially I convert AI to AI after cropping and than feed the converted AI for further processing. The stair-stepping appears from first level AI to AI file conversion itself.
Originally the image was of a photograph of a fish. As I need to compute the slope of the curve, I am trying to get rid of every detail in the image except for the dark bold curve that runs all along the body (without the tail fin or caudal fin).
I did a log transform followed by NevatiaBabu.
And this is the result:
[
Then I did dilation and erosion. I got this:
But I really want to get rid of all the extra details without using any manual handling. This is supposed to be redone automatically afterward. So any suggestions would be appreciated...
When ever I stretch a portion of the image via Transform, a faint line will be produced from the point of the stretch/transform.
Likewise when I copy and paste a portion of the image into a layer, that new layer will be surrounded by a faint line.
The biggest problem is that when I export this out to jpeg, it is more visible.
Does any one know how I can get rid of this faint line?
Example: https://i.stack.imgur.com/mqwWR.jpg
I tried different version of GIMP, 2.8.20, 2.8.22 and 2.10.8, all result in the same issue.
Cheers
I've just encountered this problems, and after trying some different options, I found that unselecting the option "Antialiasing" in the selection tool fixed the problem for me.
See image:
I am using 4-Way floodfill algorithm.
I have a transparent image with black out line.
That is staring point image(without color).
And after filling the color in this image it look like this
Please help me and let me know what can i do for proper fill.
I used and implemented myself FloodFill in other projects and the algorithm goes trough the whole draw, looking for closed spaces and then draw inside (or outside) them.
Your problem happens with every tool in the world that fills a draw, and the problem is the same, the spaces are not 100% closed.
The floodfill algorithm goes pixel by pixel and when it detect a black pixel, it stops. For example, the arm of the scuba driver is not thick enough or it has holes on it, and the flood fill algorithm manages to go trough it and not detect it as an empty space.
Nobody here can tell you why unless we take your project and analyse it, so the best I can offer is a guideline about where your error could be.
I tried the code with an image that has a very precise defined border around it (from here) and it seems to work OK with that image. I suggest perhaps that if you zoom into your image that there is some grey aliasing around the edges which won't get filled. Perhaps the algorithm has a threshold function that can be tweaked?
Try setting the andTolerance value (I tried 4 which seemed to improve my example).
//Call function to flood fill and get new image with filled color
UIImage *image1 = [self.image floodFillFromPoint:tpoint withColor:newcolor andTolerance:4];