erosion | python scripts to simulate erosion
kandi X-RAY | erosion Summary
kandi X-RAY | erosion Summary
python scripts to simulate erosion. In its final form it will be styled as a Blender add-on, currently it’s a commandline script. More information on (articles will be tagged with an 'erosion’tag ). erosion/ is the directory containing the files necessary for the Blender addon. erosion.zip is the zipped version of the directory mentioned above and can be used to install the addon (File→User Preferences→Addons→Install from file).
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Execute the mesh
- Create a grid from a mesh
- Return the faces of the mesh
- Sort mesh
- Perform fluvial erosion
- Advance the water at a given point
- Returns flow 3d
- Return the flow of the flow
- Test for numexpr
- Zero edge
- Move the curve by a given delta
- Test the diffusion of the grid
- R Compute the center of a mesh
- Return a formatted summary of the mesh
- Make the grid of the grid
- Loads a mesh from a file
- Creates a grid from a file
- Writes the result to a file
- Generate an ASCII representation of the image
- Write the text to a file
- Generate string from center
- Get current time in seconds
erosion Key Features
erosion Examples and Code Snippets
Community Discussions
Trending Discussions on erosion
QUESTION
I'm new to python, so please consider that :) I was trying to fill the holes of a binary image after applying "closing" on it without using any built-in functions. I wanted to do something like this (down below) on my Head Ct picture. continously erosion with a structuring element(+) (similar to the equation on it) so I wrote this code, but I still have a problem with the initial point.
...ANSWER
Answered 2021-Jun-08 at 16:32I have found an answer to my question, but to those, it may be their question too. I wouldn't delete my question and want to add my answer. I solved the Problem of Finding Initial you may want to know how? so I decided to find a hole point that has a zero value while the summation of the points of 4 lines around it has a value similar to be filled lines. (if you want to fill the white holes inside of a black area, you should find a point that has a 1 value while summation of the points of four lines around it is zero) here is my code:
QUESTION
ANSWER
Answered 2021-Jun-04 at 19:55Improving the quality of the output is your "holy scripture" when working with Tesseract. Especially, the page segmentation method should always be explicitly set. Here (as most of the times), I'd opt for --psm 6
:
Assume a single uniform block of text.
Even without further preprocessing of your image, you already get the desired result:
QUESTION
I tried implementing morphological erosion on digital images with Python. I uploaded a binary image and defined a structural element - ones(3,3). But when I run the code, the following error occurs:
RuntimeError: sequence argument must have length equal to input rank
Please assit. Below are my codes:
...ANSWER
Answered 2021-May-30 at 12:14Posting what I mentioned as a comment - You are trying to perform the erosion operation on a RGB image. You need to convert the RGB image to a binary image and then perform erosion with the structuring element.
QUESTION
im really trying to figure out how to count "✓" this symbol in a column for a performance monitor. I really cannot figure out the code for this... i tried a lot of possible ways but no luck. In visual basic i managed to do it but in C# ,i just cant figure it out.
Here are some code examples that i tried.
...ANSWER
Answered 2021-May-26 at 19:54In programming there is a tendency to separate the data (= model) from the way that this data is displayed (= view). This has the advantage that you can change the way that you display the data without having to change the model. So if you decide to display a checkbox instead of a check mark, your model does not have to change.
To transform the model to the view, an adapter class is needed: the ViewModel. Together these three classes are abbreviated MVVM. Consider to read some background about this.
In Winforms you can use the ViewModel by using the DataSource of the DataGridView.
If the data that you want display is very similar to the data in your model, you don't need a special display class. If the data is fairly different, it might be wise to create a special class for the Display dataSo if you want to Display Customers, you create a class DisplayCustomer:
QUESTION
I have been asking several questions for locating and extracting maze from photos on SOF, but none of the answers I get work across different photos, not even across 4 testing photos. Every time when I tweaked the code to make it work for 1 photo, it will fail on the rest of photos due to warped corners/parts or light etc. I feel that I need to find a way which is insensitive to warped image and different intensity of light or the different colors of maze walls(the lines inside a maze).
I have been trying to make it work for 3 weeks without a luck. Before I drop the idea, I would like to ask is it possible to just use Image Processing without AI to locate and extract a maze from a photo? If yes, could you please show me how to do it?
Here are the code and photos:
...ANSWER
Answered 2021-May-12 at 13:17You really want to get these $ 6.9 dishes, he?
For the four given images, I could get quite good results using the following workflow:
- White balance the input image to enforce nearly white paper. I took this approach using a small patch from the center of the image, and from that patch, I took the pixel with the highest
R + G + B
value – assuming the maze is always centered in the image, and there are some pixels from the white paper within the small patch. - Use the saturation channel from the HSV color space to mask the white paper, and (roughly) crop that portion from the image.
- On that crop, perform the existing
reconstruction
approach.
Here are the results:
maze.jpg
simple.jpg
middle.jpg
hard.jpg
That's the full code:
QUESTION
after I applied some processings e.g. cv2.Canny()
, it looks like this now:
As you can see that the black lines become hollow. I have tried erosion and dilation, but if I do them many times, the 2 entrances will be closed(meaning become connected line or closed contour).
How could I make those lines solid like the below image while keep the 2 entrances not affected?
Update 1
I have tested the following answers with a few of photos, but the code seems customized to only be able to handle this one particular picture. Due to the restriction of SOF, I cannot upload photos larger than 2MB, so I uploaded them into my Microsoft OneDrive folder for your convenience to test.
https://1drv.ms/u/s!Asflam6BEzhjgbIhgkL4rt1NLSjsZg?e=OXXKBK
Update 2
I picked up @fmw42's post as answer as his answer is the most detailed one. It doesn't answer my question but points out the correct way to process maze which is my ultimate goal. I like his approach of answering questions, firstly tells you what each step should do so that you have a clear idea about how to do the task, then provide the full code example from beginning to end. Very helpful.
Due to the limitation of SOF, I can only pick up one answer. If multiple answers are allowed, I would also pick up Shamshirsaz.Navid's answer. His answer not only points to the correct direction to solve the issue, but also the explanation with visualization really works well for me~! I guess it works equally well for all people who are trying to understand why each line of code is needed. Also he follows up my questions in comments, this makes the SOF a bit interactive :)
The Threshold track bar in Ann Zen's answer is also a very useful tip for people to quickly find out a optimal value.
...ANSWER
Answered 2021-May-07 at 15:27Canny is an edge detector. It detects the lines along which color changes. A line in your input image has two such transitions, one on each side. Therefore you see two parallel lines on each side of a line in the image. This answer of mine explains the difference between edges and lines.
So, you shouldn’t be using an edge detector to detect lines in an image.
If a simple threshold doesn't properly binarize this image, try using a local threshold ("adaptive threshold" in OpenCV). Another thing that works well for images like these is applying a top hat filter (for this image, it would be a closing(img) - img
), where the structuring element is adjusted to the width of the lines you want to find. This will result in an image that is easy to threshold and will preserve all lines thinner than the structuring element.
QUESTION
I am trying to improve this image with the help of morphological operations. The result I get is good but it takes almost 40 seconds to get the resulting image and I was wondering if there is any other method to get a similar or even better result without taking too long.
Below I attach the images and the code that i used to enhance the original image. Thanks
...ANSWER
Answered 2021-May-10 at 14:28Almost all of your time is being taken up by the closing function. This is mostly because that function's runtime scales terribly with kernel size and disk(40) is probably an 80x80 kernel under the hood. We can approximate the same thing by downscaling the image and running an equivalent-sized kernel on the smaller image.
QUESTION
I am looking to extract the coordinates of a features perimeter. My intension is to use these coordinates to find the nearest edge-to-edge Euclidean distance for all features of interest from a .tif image. I am relatively new to scikit-image and am wondering if this can be done using options available from https://scikit-image.org/docs/dev/api/skimage.measure.html#skimage.measure.regionprops ?
I am able to extract the filled area binary boolean matrix from skimage.measure.regionprops.
...ANSWER
Answered 2021-May-02 at 16:27With Bilal's response I was able to come up with a suitable solution.
QUESTION
I already asked this question and I solved one task of my original question. However, I am still struggling with obtaining a decent pre-processing image.
In general, I am trying to approximate different shapes of a weld bead geometry cross section in additive manufacturing with a graph or ideally (but not necessarily) a function. The regions are the outer shape as well as the individual layers. (see following images) Prior to that I must pre-process the image so that I can apply my algorithm which predicts the distance between the layers as well as the width of each layer.
So far, I applied some pre-processing methods to extract the relevant pixels which represent the geometry of a weld bead which are shown as white pixels (see third image) and which are relevant for predicting the height and shape of each weld bead layer. I derived this image with canny edge detection and thresholding methods in different colour spaces as (including greyscale) and multiple morphological operations such as closing erosion and dilation prior to that.
As you can see, my results weren't good, I either loose too much information of the "relevant" transition region or get too much noise between the weld bead layers. The "noisy" areas are the transition areas between individual layers of metal and only show up in this way, so in general there is not a "better" or "sharper" transition in thus less "noise". Pictures 3 and 4 are an example of some of the image pre-processing methods I used.
In my mind a somehow densitiy-based (e. g. for a binary image regarding the white pixels) denoising would maybe be helpful to eliminate the noise between the layers so in the region where it is not desired while preserving the pixels in the relevant transition region.
If anybody who's experienced in image processing or image vision can give me some advice, I would highly appreciate that!
If you need to take a look at my code, just let me know. Thank you! :)
...ANSWER
Answered 2021-Apr-24 at 19:04Here is one idea in Python/OpenCV.
Scale the image down by say 25% to emphasize the dark bands. Then average along each column. Then get the profile of the averaged data. You can then measure more accurately on the profile for the spacing and then multiply by 4 to compensate for the 25% reduction.
Input:
QUESTION
I need to draw a line in an image where no pixel is thicker than 1 pixel in the horizontal dimension.
Despite I use thickness=1 in poly lines,
...ANSWER
Answered 2021-Apr-15 at 22:23It looks like we need to use for loops.
Removing one pixel out of two horizontally adjacent pixels is an iterative operation.
I can't see a way to vectorize it, or use filtering or morphological operations.
There could be something I am missing, but I think we need to use a loop.
In case the image large, you may use Numba (or Cython) for accelerating the execution time.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install erosion
make sure that you have installed Pyhon 3.3.x outside Blender as well and that the platform macthes (i.e. if you use 64bit Blender, install a 64bit Python as well). The version of Python that comes with Blender is not added to the registry so any windows installers looking for a Python 3.3 installation won’t find it)
download the windows installer suitable for your platform (i.e. again 64 bits if that’s your Blender and Python version). Using a binary installer saves you the hassle of compiling packages yourself and many friendly people already did the hard work and provided suitable version to save you the trouble. Christoph Gohlke for example is an excellent source of installers: check http://www.lfd.uci.edu/~gohlke/pythonlibs/
run the installer and follow instructions. The installer should find the Python version you installed outside Blender in the registry
now copy the installed package from the external Python’s lib to Blender’s lib. For example on my system I have the site packages for the external Python in E:\Python33\Lib\site-packages and the site packages of my latest Blender version live in E:\blender-2.69-fd0b104-win64\blender-2.69-fd0b104-win64\2.69\python\lib\site-packages so after installation I simply copy the whole directory of a newly installed package across.
Test if it works: Open a Python console in Blender and type for example import numpy
Done, after installing the erosion addon it should work.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page