Tips for Python beginners to use the Scikit-image example for themselves

OpenCV for Python beginners So, I wrote how to execute the Python example in OpenCV (opencv directory) \ sources \ samples \ python2.

OpenCV-Python & Scikit-image-Addition to "Must-see" OpenCV-Python Tutorials "2" So, I showed how to download and execute the example from Distributor of Scikit-image.

"OpenCV-Python Tutorials", "Practical Computer Vision" and scikit-learn So, I showed how to download and execute the example from Distributor of scikit-learn.

These examples include the script and its required data as a set so you can get started. I was drawn to Python because of the appeal of OpenCV-Python, Scikit-image, and scikit-learn. The number of people coming is increasing.

In this article, I'll write some Python beginners to play with the Scikit-image example with a slight modification.

** Hint: Let's replace the input image. ** **

Reference article [Series] "CV programming using python and OpenCV" Part 8: OpenCV-python ① Image input / output and visualization (highGUI)) OpenCV-Python, scikit-image, scikit-learn all use a common data format. for that reason, You can replace the input data in the scikit-image example script with OpenCV-Python cv2.imread ("lena.jpg ") and so on. If you replace the input data, you will find various things.

Task: [Normalized Cut] (http://scikit-image.org/docs/dev/auto_examples/segmentation/plot_ncut.html#example-segmentation-plot-ncut-py)

Let's change the input image with the example of.

** Hint: Enter reduced image **

Let's change the size of the input image. Search for cv2.resize (). Image processing by python + Opencv 5 (resize) Since the return value of cv2.resize () is the reduced image, A feature of the Python library is that it is easy to distinguish between the input and output of a function.

Task:

[Normalized Cut] (http://scikit-image.org/docs/dev/auto_examples/segmentation/plot_ncut.html#example-segmentation-plot-ncut-py)

Let's reduce the input image in half and operate it with the example of.

** Hint: Let's cut out a partial image. ** **

OpenCV-Python, scikit-image, and scikit-learn all use a common data format. For color images, specify subscripts in the order of img [y coordinate, x coordinate, BGR]. In grayscale images, it is a subscript of gray [y coordinate, x coordinate]. To know the size of the image [h, w] = img.shape[:2] [h, w] = gray.shape It will be. The range of the y coordinate has a minimum value of 0 and a maximum value of h-1. The x-coordinate range has a minimum value of 0 and a maximum value of w-1.

subImg = img[yu:yd, xl:xr, :] When, the point (yu, yd) is included in the partial image, Keep in mind that the yd and xr positions are not included in the partial image.

Reference article Split images with Python and OpenCV

Task:

Try using the above Normalized Cut to make the input image a partial image.

** Note: **

In the case of OpenCV-C ++, the data format of cv :: Mat is used. Also in this case cv::Mat img = cv2.imread("lena.jpg ", 0);

To access the elements of cv :: Mat The first subscript is y and the second subscript is x. This is common to both OpenCV-Python using numpy.array and OpenCV-C ++ using cv :: Mat. img.at(y,x)

Hint 2 Process multiple files

Recommended Posts

Tips for Python beginners to use the Scikit-image example for themselves
Tips for Python beginners to use the Scikit-image example for themselves 9 Use from C
Tips for Python beginners to use the Scikit-image example for themselves 6 Improve Python code
Tips for Python beginners to use the Scikit-image example for themselves 2 Handle multiple files
Tips for Python beginners to use the Scikit-image example for themselves 7 How to make a module
Tips for Python beginners to use Scikit-image examples for themselves 4 Use GUI
Tips for Python beginners to use the Scikit-image example for themselves 8 Processing time measurement and profiler
Tips for Python beginners to use Scikit-image examples for themselves 3 Write to a file
Tips for Python beginners to use Scikit-image examples for themselves 5 Incorporate into network apps
~ Tips for beginners to Python ③ ~
The fastest way for beginners to master Python
[For beginners] How to use say command in python!
[python] How to use the library Matplotlib for drawing graphs
I didn't know how to use the [python] for statement
Beginners use Python for web scraping (1)
Beginners use Python for web scraping (4) ―― 1
[Introduction to Python] How to use the in operator in a for statement?
[Python] Explains how to use the format function with an example
[Python] Organizing how to use for statements
How to use "deque" for Python data
[Python] Explains how to use the range function with a concrete example
Memo # 4 for Python beginners to read "Detailed Python Grammar"
How to use the C library in Python
How to use MkDocs for the first time
Python for super beginners Python for super beginners # Easy to get angry
Specify the Python executable to use with virtualenv
Memo # 3 for Python beginners to read "Detailed Python Grammar"
Use logger with Python for the time being
~ Tips for Python beginners from Pythonista with love ① ~
How to use data analysis tools for beginners
Tips for hitting the ATND API in Python
The easiest way to use OpenCV with python
Try to calculate RPN in Python (for beginners)
[Algorithm x Python] How to use the list
Use the Python framework "cocotb" to test Verilog.
Memo # 2 for Python beginners to read "Detailed Python Grammar"
Memo # 7 for Python beginners to read "Detailed Python Grammar"
Introduction to Programming (Python) TA Tendency for beginners
Memo # 6 for Python beginners to read "Detailed Python Grammar"
How to make Python faster for beginners [numpy]
~ Tips for Python beginners from Pythonista with love ② ~
Memo # 5 for Python beginners to read "Detailed Python Grammar"
Tips for those who are wondering how to use is and == in Python
python textbook for beginners
OpenCV for Python beginners
python beginners tried to predict the number of criminals
[BigQuery] How to use BigQuery API for Python -Table creation-
Beginners can use Python for web scraping (1) Improved version
How to convert Python # type for Python super beginners: str
How to use the Raspberry Pi relay module Python
I wanted to use the Python library from MATLAB
[Python] How to use the graph creation library Altair
Specify MinGW as the compiler to use with Python
[Introduction to Udemy Python3 + Application] 27. How to use the dictionary
[Introduction to Udemy Python3 + Application] 30. How to use the set
How to use the model learned in Lobe in Python
Python # How to check type and type for super beginners
I want to use the R dataset in python
Beginners use Python for web scraping (4) --2 Scraping on Cloud Shell
[For beginners] Web scraping with Python "Access the URL in the page to get the contents"
python3: How to use bottle (2)