Skip to content

Commit c3586b8

Browse files
authored
Merge pull request opencv#9055 from fdebrabander:master
how_to_scan_images.markdown: fix grammar mistakes
2 parents 7621cc1 + 36b00e6 commit c3586b8

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

doc/tutorials/core/how_to_scan_images/how_to_scan_images.markdown

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Its strength lies that we do not need to make the calculation, we just need to r
4646

4747
Our test case program (and the sample presented here) will do the following: read in a console line
4848
argument image (that may be either color or gray scale - console line argument too) and apply the
49-
reduction with the given console line argument integer value. In OpenCV, at the moment they are
49+
reduction with the given console line argument integer value. In OpenCV, at the moment there are
5050
three major ways of going through an image pixel by pixel. To make things a little more interesting
5151
will make the scanning for each image using all of these methods, and print out how long it took.
5252

@@ -78,11 +78,11 @@ cout << "Times passed in seconds: " << t << endl;
7878
@endcode
7979

8080
@anchor tutorial_how_to_scan_images_storing
81-
How the image matrix is stored in the memory?
82-
---------------------------------------------
81+
How is the image matrix stored in memory?
82+
-----------------------------------------
8383

8484
As you could already read in my @ref tutorial_mat_the_basic_image_container tutorial the size of the matrix
85-
depends of the color system used. More accurately, it depends from the number of channels used. In
85+
depends on the color system used. More accurately, it depends from the number of channels used. In
8686
case of a gray scale image we have something like:
8787

8888
![](tutorial_how_matrix_stored_1.png)
@@ -107,14 +107,14 @@ Therefore, the most efficient method we can recommend for making the assignment
107107
@snippet how_to_scan_images.cpp scan-c
108108

109109
Here we basically just acquire a pointer to the start of each row and go through it until it ends.
110-
In the special case that the matrix is stored in a continues manner we only need to request the
110+
In the special case that the matrix is stored in a continuous manner we only need to request the
111111
pointer a single time and go all the way to the end. We need to look out for color images: we have
112112
three channels so we need to pass through three times more items in each row.
113113

114114
There's another way of this. The *data* data member of a *Mat* object returns the pointer to the
115115
first row, first column. If this pointer is null you have no valid input in that object. Checking
116116
this is the simplest method to check if your image loading was a success. In case the storage is
117-
continues we can use this to go through the whole data pointer. In case of a gray scale image this
117+
continuous we can use this to go through the whole data pointer. In case of a gray scale image this
118118
would look like:
119119
@code{.cpp}
120120
uchar* p = I.data;
@@ -150,7 +150,7 @@ On-the-fly address calculation with reference returning
150150
The final method isn't recommended for scanning. It was made to acquire or modify somehow random
151151
elements in the image. Its basic usage is to specify the row and column number of the item you want
152152
to access. During our earlier scanning methods you could already observe that is important through
153-
what type we are looking at the image. It's no different here as you need manually to specify what
153+
what type we are looking at the image. It's no different here as you need to manually specify what
154154
type to use at the automatic lookup. You can observe this in case of the gray scale images for the
155155
following source code (the usage of the + @ref cv::at() function):
156156

@@ -164,7 +164,7 @@ nice output message of this on the standard error output stream. Compared to the
164164
release mode the only difference in using this is that for every element of the image you'll get a
165165
new row pointer for what we use the C operator[] to acquire the column element.
166166

167-
If you need to multiple lookups using this method for an image it may be troublesome and time
167+
If you need to do multiple lookups using this method for an image it may be troublesome and time
168168
consuming to enter the type and the at keyword for each of the accesses. To solve this problem
169169
OpenCV has a @ref cv::Mat_ data type. It's the same as Mat with the extra need that at definition
170170
you need to specify the data type through what to look at the data matrix, however in return you can
@@ -177,10 +177,10 @@ to write for the lazy programmer trick.
177177
The Core Function
178178
-----------------
179179

180-
This is a bonus method of achieving lookup table modification in an image. Because in image
181-
processing it's quite common that you want to replace all of a given image value to some other value
182-
OpenCV has a function that makes the modification without the need from you to write the scanning of
183-
the image. We use the @ref cv::LUT() function of the core module. First we build a Mat type of the
180+
This is a bonus method of achieving lookup table modification in an image. In image
181+
processing it's quite common that you want to modify all of a given image values to some other value.
182+
OpenCV provides a function for modifying image values, without the need to write the scanning logic
183+
of the image. We use the @ref cv::LUT() function of the core module. First we build a Mat type of the
184184
lookup table:
185185

186186
@snippet how_to_scan_images.cpp table-init
@@ -192,8 +192,8 @@ Finally call the function (I is our input image and J the output one):
192192
Performance Difference
193193
----------------------
194194

195-
For the best result compile the program and run it on your own speed. For showing off better the
196-
differences I've used a quite large (2560 X 1600) image. The performance presented here are for
195+
For the best result compile the program and run it on your own speed. To make the differences more
196+
clear, I've used a quite large (2560 X 1600) image. The performance presented here are for
197197
color images. For a more accurate value I've averaged the value I got from the call of the function
198198
for hundred times.
199199

@@ -205,7 +205,7 @@ On-The-Fly RA | 93.7878 milliseconds
205205
LUT function | 32.5759 milliseconds
206206

207207
We can conclude a couple of things. If possible, use the already made functions of OpenCV (instead
208-
reinventing these). The fastest method turns out to be the LUT function. This is because the OpenCV
208+
of reinventing these). The fastest method turns out to be the LUT function. This is because the OpenCV
209209
library is multi-thread enabled via Intel Threaded Building Blocks. However, if you need to write a
210210
simple image scan prefer the pointer method. The iterator is a safer bet, however quite slower.
211211
Using the on-the-fly reference access method for full image scan is the most costly in debug mode.

0 commit comments

Comments
 (0)