Skip to content

Commit

Permalink
70
Browse files Browse the repository at this point in the history
  • Loading branch information
gzr2017 committed Nov 29, 2019
1 parent f4e0f99 commit b97ffbe
Show file tree
Hide file tree
Showing 80 changed files with 4,513 additions and 4,492 deletions.
Empty file modified Dataset/test/akahara_0009.jpg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified Dataset/test/akahara_0010.jpg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified Dataset/test/akahara_0011.jpg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified Dataset/test/madara_0009.jpg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified Dataset/test/madara_0010.jpg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified Dataset/test/madara_0011.jpg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified Dataset/train/akahara_0004.jpg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified Dataset/train/akahara_0005.jpg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified Dataset/train/akahara_0007.jpg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified Dataset/train/madara_0001.jpg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified Dataset/train/madara_0003.jpg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified Dataset/train/madara_0006.jpg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
524 changes: 262 additions & 262 deletions Image_processing_tips.ipynb

Large diffs are not rendered by default.

Binary file added Question_01_10/.DS_Store
Binary file not shown.
504 changes: 252 additions & 252 deletions Question_01_10/README.md

Large diffs are not rendered by default.

58 changes: 29 additions & 29 deletions Question_01_10/answers_py/answer_1.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
import cv2

# function: BGR -> RGB


def BGR2RGB(img):
b = img[:, :, 0].copy()
g = img[:, :, 1].copy()
r = img[:, :, 2].copy()

# RGB > BGR
img[:, :, 0] = r
img[:, :, 1] = g
img[:, :, 2] = b

return img


# Read image
img = cv2.imread("../imori.jpg")

# BGR -> RGB
img = BGR2RGB(img)

# Save result
cv2.imwrite("out.jpg", img)
cv2.imshow("result", img)
cv2.waitKey(0)
cv2.destroyAllWindows()
import cv2

# function: BGR -> RGB


def BGR2RGB(img):
b = img[:, :, 0].copy()
g = img[:, :, 1].copy()
r = img[:, :, 2].copy()

# RGB > BGR
img[:, :, 0] = r
img[:, :, 1] = g
img[:, :, 2] = b

return img


# Read image
img = cv2.imread("../imori.jpg")

# BGR -> RGB
img = BGR2RGB(img)

# Save result
cv2.imwrite("out.jpg", img)
cv2.imshow("result", img)
cv2.waitKey(0)
cv2.destroyAllWindows()
80 changes: 40 additions & 40 deletions Question_01_10/answers_py/answer_3.py
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
import cv2
import numpy as np

# Gray scale


def BGR2GRAY(img):
b = img[:, :, 0].copy()
g = img[:, :, 1].copy()
r = img[:, :, 2].copy()

# Gray scale
out = 0.2126 * r + 0.7152 * g + 0.0722 * b
out = out.astype(np.uint8)

return out

# binalization


def binarization(img, th=128):
img[img < th] = 0
img[img >= th] = 255
return img


# Read image
img = cv2.imread("../imori.jpg").astype(np.float32)

# Grayscale
out = BGR2GRAY(img)

# Binarization
out = binarization(out)

# Save result
cv2.imwrite("out.jpg", out)
cv2.imshow("result", out)
cv2.waitKey(0)
cv2.destroyAllWindows()
import cv2
import numpy as np

# Gray scale


def BGR2GRAY(img):
b = img[:, :, 0].copy()
g = img[:, :, 1].copy()
r = img[:, :, 2].copy()

# Gray scale
out = 0.2126 * r + 0.7152 * g + 0.0722 * b
out = out.astype(np.uint8)

return out

# binalization


def binarization(img, th=128):
img[img < th] = 0
img[img >= th] = 255
return img


# Read image
img = cv2.imread("../imori.jpg").astype(np.float32)

# Grayscale
out = BGR2GRAY(img)

# Binarization
out = binarization(out)

# Save result
cv2.imwrite("out.jpg", out)
cv2.imshow("result", out)
cv2.waitKey(0)
cv2.destroyAllWindows()
Empty file modified Question_01_10/imori.jpg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Question_11_20/.DS_Store
Binary file not shown.
Loading

0 comments on commit b97ffbe

Please sign in to comment.