I'm new learning python and image processing with python. For this reason, I took a project called "Classification of breast cancer images with deep learning".
I applied the following techniques: 1)Threshold, 2)K-Means
import cv2
import numpy as np
import matplotlib.pyplot as plt
img = cv2.imread('n001.tif', 0)
_, blackAndWhite = cv2.threshold(img, 100, 255, cv2.THRESH_BINARY_INV)
nlabels, labels, stats, centroids = cv2.connectedComponentsWithStats(blackAndWhite, None, None, None, 8, cv2.CV_32S)
sizes = stats[1:, -1] #get CC_STAT_AREA component
img2 = np.zeros((labels.shape), np.uint8)
for i in range(0, nlabels - 1):
if sizes[i] >= 100: #filter small dotted regions
img2[labels == i + 1] = 255
res = cv2.bitwise_not(img2)
cv2.imwrite('n001New.tif', res)
########################################################################
img = cv2.cvtColor(res, cv2.COLOR_BGR2RGB)
Z = img.reshape((-1,3))
Z = np.float32(Z)
criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 250 , 1.0)
K=2
ret, label, center= cv2.kmeans(Z, K, None, criteria, 250,
cv2.KMEANS_RANDOM_CENTERS)
center = np.uint8(center)
res = center[label.flatten()]
output = res.reshape((img.shape))
plt.imshow(output)
plt.show()
Data set consists of tif extension image: benign, inSitu, invasive and normal Input images
Output images:Output images
I have a few questions:
- Are my methods correct?
- Are the outputs correct? Do I find the right areas?
- Did I use the K-Means algorithm correctly? Which values will I send to cnn?
I would appreciate it if you could answer the questions above.
I'm new learning python and image processing with python. For this reason, I took a project called "Classification of breast cancer images with deep learning".
I applied the following techniques: 1)Threshold, 2)K-Means
import cv2
import numpy as np
import matplotlib.pyplot as plt
img = cv2.imread('n001.tif', 0)
_, blackAndWhite = cv2.threshold(img, 100, 255, cv2.THRESH_BINARY_INV)
nlabels, labels, stats, centroids = cv2.connectedComponentsWithStats(blackAndWhite, None, None, None, 8, cv2.CV_32S)
sizes = stats[1:, -1] #get CC_STAT_AREA component
img2 = np.zeros((labels.shape), np.uint8)
for i in range(0, nlabels - 1):
if sizes[i] >= 100: #filter small dotted regions
img2[labels == i + 1] = 255
res = cv2.bitwise_not(img2)
cv2.imwrite('n001New.tif', res)
########################################################################
img = cv2.cvtColor(res, cv2.COLOR_BGR2RGB)
Z = img.reshape((-1,3))
Z = np.float32(Z)
criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 250 , 1.0)
K=2
ret, label, center= cv2.kmeans(Z, K, None, criteria, 250,
cv2.KMEANS_RANDOM_CENTERS)
center = np.uint8(center)
res = center[label.flatten()]
output = res.reshape((img.shape))
plt.imshow(output)
plt.show()
Data set consists of tif extension image: benign, inSitu, invasive and normal Input images
Output images:Output images
I have a few questions:
- Are my methods correct?
- Are the outputs correct? Do I find the right areas?
- Did I use the K-Means algorithm correctly? Which values will I send to cnn?
I would appreciate it if you could answer the questions above.
I'm new learning python and image processing with python. For this reason, I took a project called "Classification of breast cancer images with deep learning".
I applied the following techniques: 1)Threshold, 2)K-Means
import cv2
import numpy as np
import matplotlib.pyplot as plt
img = cv2.imread('n001.tif', 0)
_, blackAndWhite = cv2.threshold(img, 100, 255, cv2.THRESH_BINARY_INV)
nlabels, labels, stats, centroids = cv2.connectedComponentsWithStats(blackAndWhite, None, None, None, 8, cv2.CV_32S)
sizes = stats[1:, -1] #get CC_STAT_AREA component
img2 = np.zeros((labels.shape), np.uint8)
for i in range(0, nlabels - 1):
if sizes[i] >= 100: #filter small dotted regions
img2[labels == i + 1] = 255
res = cv2.bitwise_not(img2)
cv2.imwrite('n001New.tif', res)
########################################################################
img = cv2.cvtColor(res, cv2.COLOR_BGR2RGB)
Z = img.reshape((-1,3))
Z = np.float32(Z)
criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 250 , 1.0)
K=2
ret, label, center= cv2.kmeans(Z, K, None, criteria, 250,
cv2.KMEANS_RANDOM_CENTERS)
center = np.uint8(center)
res = center[label.flatten()]
output = res.reshape((img.shape))
plt.imshow(output)
plt.show()
Data set consists of tif extension image: benign, inSitu, invasive and normal Input images
Output images:Output images
I have a few questions:
- Are my methods correct?
- Are the outputs correct? Do I find the right areas?
- Did I use the K-Means algorithm correctly?
I would appreciate it if you could answer the questions above.
I'm new learning python and image processing with python. For this reason, I took a project called "Classification of breast cancer images with deep learning".
I applied the following techniques: 1)Threshold, 2)K-Means
import cv2
import numpy as np
import matplotlib.pyplot as plt
img = cv2.imread('n001.tif', 0)
_, blackAndWhite = cv2.threshold(img, 100, 255, cv2.THRESH_BINARY_INV)
nlabels, labels, stats, centroids = cv2.connectedComponentsWithStats(blackAndWhite, None, None, None, 8, cv2.CV_32S)
sizes = stats[1:, -1] #get CC_STAT_AREA component
img2 = np.zeros((labels.shape), np.uint8)
for i in range(0, nlabels - 1):
if sizes[i] >= 100: #filter small dotted regions
img2[labels == i + 1] = 255
res = cv2.bitwise_not(img2)
cv2.imwrite('n001New.tif', res)
########################################################################
img = cv2.cvtColor(res, cv2.COLOR_BGR2RGB)
Z = img.reshape((-1,3))
Z = np.float32(Z)
criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 250 , 1.0)
K=2
ret, label, center= cv2.kmeans(Z, K, None, criteria, 250,
cv2.KMEANS_RANDOM_CENTERS)
center = np.uint8(center)
res = center[label.flatten()]
output = res.reshape((img.shape))
plt.imshow(output)
plt.show()
Data set consists of tif extension image: benign, inSitu, invasive and normal Input images
Output images:Output images
I have a few questions:
- Are my methods correct?
- Are the outputs correct? Do I find the right areas?
- Did I use the K-Means algorithm correctly? WhatWhich values will I send to cnn?
I would appreciate it if you could answer the questions above.
I'm new learning python and image processing with python. For this reason, I took a project called "Classification of breast cancer images with deep learning".
I applied the following techniques: 1)Threshold, 2)K-Means
import cv2
import numpy as np
import matplotlib.pyplot as plt
img = cv2.imread('n001.tif', 0)
_, blackAndWhite = cv2.threshold(img, 100, 255, cv2.THRESH_BINARY_INV)
nlabels, labels, stats, centroids = cv2.connectedComponentsWithStats(blackAndWhite, None, None, None, 8, cv2.CV_32S)
sizes = stats[1:, -1] #get CC_STAT_AREA component
img2 = np.zeros((labels.shape), np.uint8)
for i in range(0, nlabels - 1):
if sizes[i] >= 100: #filter small dotted regions
img2[labels == i + 1] = 255
res = cv2.bitwise_not(img2)
cv2.imwrite('n001New.tif', res)
########################################################################
img = cv2.cvtColor(res, cv2.COLOR_BGR2RGB)
Z = img.reshape((-1,3))
Z = np.float32(Z)
criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 250 , 1.0)
K=2
ret, label, center= cv2.kmeans(Z, K, None, criteria, 250,
cv2.KMEANS_RANDOM_CENTERS)
center = np.uint8(center)
res = center[label.flatten()]
output = res.reshape((img.shape))
plt.imshow(output)
plt.show()
Data set consists of tif extension image: benign, inSitu, invasive and normal Input images
Output images:Output images
I have a few questions:
- Are my methods correct?
- Are the outputs correct? Do I find the right areas?
- Did I use the K-Means algorithm correctly? What values will I send to cnn?
I would appreciate it if you could answer the questions above.
I'm new learning python and image processing with python. For this reason, I took a project called "Classification of breast cancer images with deep learning".
I applied the following techniques: 1)Threshold, 2)K-Means
import cv2
import numpy as np
import matplotlib.pyplot as plt
img = cv2.imread('n001.tif', 0)
_, blackAndWhite = cv2.threshold(img, 100, 255, cv2.THRESH_BINARY_INV)
nlabels, labels, stats, centroids = cv2.connectedComponentsWithStats(blackAndWhite, None, None, None, 8, cv2.CV_32S)
sizes = stats[1:, -1] #get CC_STAT_AREA component
img2 = np.zeros((labels.shape), np.uint8)
for i in range(0, nlabels - 1):
if sizes[i] >= 100: #filter small dotted regions
img2[labels == i + 1] = 255
res = cv2.bitwise_not(img2)
cv2.imwrite('n001New.tif', res)
########################################################################
img = cv2.cvtColor(res, cv2.COLOR_BGR2RGB)
Z = img.reshape((-1,3))
Z = np.float32(Z)
criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 250 , 1.0)
K=2
ret, label, center= cv2.kmeans(Z, K, None, criteria, 250,
cv2.KMEANS_RANDOM_CENTERS)
center = np.uint8(center)
res = center[label.flatten()]
output = res.reshape((img.shape))
plt.imshow(output)
plt.show()
Data set consists of tif extension image: benign, inSitu, invasive and normal Input images
Output images:Output images
I have a few questions:
- Are my methods correct?
- Are the outputs correct? Do I find the right areas?
- Did I use the K-Means algorithm correctly? Which values will I send to cnn?
I would appreciate it if you could answer the questions above.
I'm new learning python and image processing with python. For this reason, I took a project called "Classification of breast cancer images with deep learning".
I applied the following techniques: 1)Threshold, 2)K-Means
import cv2
import numpy as np
import matplotlib.pyplot as plt
img = cv2.imread('n001.tif', 0)
_, blackAndWhite = cv2.threshold(img, 100, 255, cv2.THRESH_BINARY_INV)
nlabels, labels, stats, centroids = cv2.connectedComponentsWithStats(blackAndWhite, None, None, None, 8, cv2.CV_32S)
sizes = stats[1:, -1] #get CC_STAT_AREA component
img2 = np.zeros((labels.shape), np.uint8)
for i in range(0, nlabels - 1):
if sizes[i] >= 100: #filter small dotted regions
img2[labels == i + 1] = 255
res = cv2.bitwise_not(img2)
cv2.imwrite('n001New.tif', res)
########################################################################
img = cv2.cvtColor(res, cv2.COLOR_BGR2RGB)
Z = img.reshape((-1,3))
Z = np.float32(Z)
criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 250 , 1.0)
K=2
ret, label, center= cv2.kmeans(Z, K, None, criteria, 250,
cv2.KMEANS_RANDOM_CENTERS)
center = np.uint8(center)
res = center[label.flatten()]
output = res.reshape((img.shape))
plt.imshow(output)
plt.show()
Data set consists of tif extension image: benign, inSitu, invasive and normal Input images
Output images:Output images
I have a few questions:
- Are my methods correct?
- Are the outputs correct? Do I find the right areas?
- Did I use the K-Means algorithm correctly? What values will I send to cnn?
I would appreciate it if you could answer the questions above.
I'm new learning python and image processing with python. For this reason, I took a project called "Classification of breast cancer images with deep learning".
I applied the following techniques: 1)Threshold, 2)K-Means
import cv2
import numpy as np
import matplotlib.pyplot as plt
img = cv2.imread('n001.tif', 0)
_, blackAndWhite = cv2.threshold(img, 100, 255, cv2.THRESH_BINARY_INV)
nlabels, labels, stats, centroids = cv2.connectedComponentsWithStats(blackAndWhite, None, None, None, 8, cv2.CV_32S)
sizes = stats[1:, -1] #get CC_STAT_AREA component
img2 = np.zeros((labels.shape), np.uint8)
for i in range(0, nlabels - 1):
if sizes[i] >= 100: #filter small dotted regions
img2[labels == i + 1] = 255
res = cv2.bitwise_not(img2)
cv2.imwrite('n001New.tif', res)
########################################################################
img = cv2.cvtColor(res, cv2.COLOR_BGR2RGB)
Z = img.reshape((-1,3))
Z = np.float32(Z)
criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 250 , 1.0)
K=2
ret, label, center= cv2.kmeans(Z, K, None, criteria, 250,
cv2.KMEANS_RANDOM_CENTERS)
center = np.uint8(center)
res = center[label.flatten()]
output = res.reshape((img.shape))
plt.imshow(output)
plt.show()
Data set consists of tif extension image: benign, inSitu, invasive and normal Input images
Output images:Output images
I have a few questions:
- Are my methods correct?
- Are the outputs correct? Do I find the right areas?
- Did I use the K-Means algorithm correctly?
I'm new learning python and image processing with python. For this reason, I took a project called "Classification of breast cancer images with deep learning".
I applied the following techniques: 1)Threshold, 2)K-Means
import cv2
import numpy as np
import matplotlib.pyplot as plt
img = cv2.imread('n001.tif', 0)
_, blackAndWhite = cv2.threshold(img, 100, 255, cv2.THRESH_BINARY_INV)
nlabels, labels, stats, centroids = cv2.connectedComponentsWithStats(blackAndWhite, None, None, None, 8, cv2.CV_32S)
sizes = stats[1:, -1] #get CC_STAT_AREA component
img2 = np.zeros((labels.shape), np.uint8)
for i in range(0, nlabels - 1):
if sizes[i] >= 100: #filter small dotted regions
img2[labels == i + 1] = 255
res = cv2.bitwise_not(img2)
cv2.imwrite('n001New.tif', res)
########################################################################
img = cv2.cvtColor(res, cv2.COLOR_BGR2RGB)
Z = img.reshape((-1,3))
Z = np.float32(Z)
criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 250 , 1.0)
K=2
ret, label, center= cv2.kmeans(Z, K, None, criteria, 250,
cv2.KMEANS_RANDOM_CENTERS)
center = np.uint8(center)
res = center[label.flatten()]
output = res.reshape((img.shape))
plt.imshow(output)
plt.show()
Data set consists of tif extension image: benign, inSitu, invasive and normal Input images
Output images:Output images
I have a few questions:
- Are my methods correct?
- Are the outputs correct? Do I find the right areas?
- Did I use the K-Means algorithm correctly? What values will I send to cnn?
I would appreciate it if you could answer the questions above.
- 145.5k
- 22
- 190
- 478