Skip to content

Commit 0246cff

Browse files
authored
Fix up grammatical errors in python tutorial
1 parent fee2049 commit 0246cff

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

doc/py_tutorials/py_core/py_basic_ops/py_basic_ops.markdown

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ You can modify the pixel values the same way.
5050
Numpy is a optimized library for fast array calculations. So simply accessing each and every pixel
5151
values and modifying it will be very slow and it is discouraged.
5252

53-
@note Above mentioned method is normally used for selecting a region of array, say first 5 rows and
54-
last 3 columns like that. For individual pixel access, Numpy array methods, array.item() and
55-
array.itemset() is considered to be better. But it always returns a scalar. So if you want to access
53+
@note The above method is normally used for selecting a region of an array, say the first 5 rows
54+
and last 3 columns. For individual pixel access, the Numpy array methods, array.item() and
55+
array.itemset() are considered better, however they always return a scalar. If you want to access
5656
all B,G,R values, you need to call array.item() separately for all.
5757

5858
Better pixel accessing and editing method :
@@ -73,15 +73,15 @@ Accessing Image Properties
7373
Image properties include number of rows, columns and channels, type of image data, number of pixels
7474
etc.
7575

76-
Shape of image is accessed by img.shape. It returns a tuple of number of rows, columns and channels
76+
The shape of an image is accessed by img.shape. It returns a tuple of number of rows, columns, and channels
7777
(if image is color):
7878
@code{.py}
7979
>>> print( img.shape )
8080
(342, 548, 3)
8181
@endcode
8282

83-
@note If image is grayscale, tuple returned contains only number of rows and columns. So it is a
84-
good method to check if loaded image is grayscale or color image.
83+
@note If an image is grayscale, the tuple returned contains only the number of rows
84+
and columns, so it is a good method to check whether the loaded image is grayscale or color.
8585

8686
Total number of pixels is accessed by `img.size`:
8787
@code{.py}
@@ -101,9 +101,9 @@ Image ROI
101101
---------
102102

103103
Sometimes, you will have to play with certain region of images. For eye detection in images, first
104-
face detection is done all over the image and when face is obtained, we select the face region alone
105-
and search for eyes inside it instead of searching whole image. It improves accuracy (because eyes
106-
are always on faces :D ) and performance (because we search for a small area)
104+
face detection is done all over the image. When a face is obtained, we select the face region alone
105+
and search for eyes inside it instead of searching the whole image. It improves accuracy (because eyes
106+
are always on faces :D ) and performance (because we search in a small area).
107107

108108
ROI is again obtained using Numpy indexing. Here I am selecting the ball and copying it to another
109109
region in the image:
@@ -118,9 +118,9 @@ Check the results below:
118118
Splitting and Merging Image Channels
119119
------------------------------------
120120

121-
Sometimes you will need to work separately on B,G,R channels of image. Then you need to split the
122-
BGR images to single planes. Or another time, you may need to join these individual channels to BGR
123-
image. You can do it simply by:
121+
Sometimes you will need to work separately on B,G,R channels of image. In this case, you need
122+
to split the BGR images to single channels. In other cases, you may need to join these individual
123+
channels to a BGR image. You can do it simply by:
124124
@code{.py}
125125
>>> b,g,r = cv2.split(img)
126126
>>> img = cv2.merge((b,g,r))
@@ -129,13 +129,13 @@ Or
129129
@code
130130
>>> b = img[:,:,0]
131131
@endcode
132-
Suppose, you want to make all the red pixels to zero, you need not split like this and put it equal
133-
to zero. You can simply use Numpy indexing, and that is faster.
132+
Suppose you want to set all the red pixels to zero, you do not need to split the channels first.
133+
Numpy indexing is faster:
134134
@code{.py}
135135
>>> img[:,:,2] = 0
136136
@endcode
137137

138-
**warning**
138+
**Warning**
139139

140140
cv2.split() is a costly operation (in terms of time). So do it only if you need it. Otherwise go
141141
for Numpy indexing.
@@ -144,7 +144,7 @@ Making Borders for Images (Padding)
144144
-----------------------------------
145145

146146
If you want to create a border around the image, something like a photo frame, you can use
147-
**cv2.copyMakeBorder()** function. But it has more applications for convolution operation, zero
147+
**cv2.copyMakeBorder()**. But it has more applications for convolution operation, zero
148148
padding etc. This function takes following arguments:
149149

150150
- **src** - input image
@@ -190,7 +190,7 @@ plt.subplot(236),plt.imshow(constant,'gray'),plt.title('CONSTANT')
190190

191191
plt.show()
192192
@endcode
193-
See the result below. (Image is displayed with matplotlib. So RED and BLUE planes will be
193+
See the result below. (Image is displayed with matplotlib. So RED and BLUE channels will be
194194
interchanged):
195195

196196
![image](images/border.jpg)

0 commit comments

Comments
 (0)