image-segmentation

OpenCV image segmentation in C++ using Watershed

无人久伴 提交于 2021-02-18 08:11:14
问题 Hi i'm currently writing a basic C++ application using the OpenCV library to segment the subject of the image from its background. The application reads in an image file and uses the watershed algorithm to generate a mask based on data it finds around the edges and data it finds in the centre of the image. (To start I created an image object that has an overall value of -1. Then I created a border around an empty image which has a value of 1. Then I created a rectangle roughly in the centre

Using a PNG image as mask for GrabCut

独自空忆成欢 提交于 2021-02-18 07:58:10
问题 I have a png image with green and red lines and transparent background, which I need to use is as a mask for executing GrabCut. But I get unexpected results. Here's my code: //find the mask Mat mask; mask.create( image.size(), CV_8UC1); mask.setTo(Scalar::all(GC_BGD)); Mat maskImg = imread("messi5.png"); for(int i=0; i<maskImg.cols; i++) for(int j=0; j<maskImg.rows; j++) { //if it's red, make it white if ((int)maskImg.at<cv::Vec3b>(j,i)[0]==0 && (int)maskImg.at<cv::Vec3b>(j,i)[1] == 0 && (int

how to segment the connected area based on depth color in opencv

拜拜、爱过 提交于 2021-02-18 06:33:38
问题 I have a picture like , which i need to segment the picture into 8 blocks. I have tried this threshold method img_gray = cv2.imread(input_file,cv2.IMREAD_GRAYSCALE) ret,thresh = cv2.threshold(img_gray,254,255,cv2.THRESH_BINARY) = kernel = np.array(cv2.getStructuringElement(cv2.MORPH_RECT, (3, 3), (-1, -1))) img_open = cv2.morphologyEx(thresh, cv2.MORPH_OPEN, kernel) cv2.imshow('abc',img_open) ret1,thresh1 = cv2.threshold(img_open,254,255,cv2.THRESH_BINARY_INV) # contours, hierarchy = cv2

Upsampling in Semantic Segmentation

生来就可爱ヽ(ⅴ<●) 提交于 2021-02-09 11:14:29
问题 I am trying to implement a paper on Semantic Segmentation and I am confused about how to Upsample the prediction map produced by my segmentation network to match the input image size. For example, I am using a variant of Resnet101 as the segmentation network (as used by the paper). With this network structure, an input of size 321x321 (again used in the paper) produces a final prediction map of size 41x41xC (C is the number of classes). Because I have to make pixel-level predictions, I need

Upsampling in Semantic Segmentation

懵懂的女人 提交于 2021-02-09 11:13:47
问题 I am trying to implement a paper on Semantic Segmentation and I am confused about how to Upsample the prediction map produced by my segmentation network to match the input image size. For example, I am using a variant of Resnet101 as the segmentation network (as used by the paper). With this network structure, an input of size 321x321 (again used in the paper) produces a final prediction map of size 41x41xC (C is the number of classes). Because I have to make pixel-level predictions, I need

Marking boundary given mask

别来无恙 提交于 2021-02-08 09:32:28
问题 I have a volume of image slices and their according masks. I've been trying to use skimage.segmentation library to mark the object in mind for each slice according to its mask. import numpy as np from skimage.segmentation import mark_boundaries import matplotlib.pyplot as plt def plot_marked_volume(marked_image_volume, mask): for slice in range(len(marked_image_volume)): if np.count_nonzero(mask[slice,:,:]): plt.figure(figsize=(10,10)) edges_pz = mark_boundaries(marked_image_volume[slice,:,:]

Why I get 0s as output when I tried to calculate accuracy for image segmented result?

耗尽温柔 提交于 2021-02-08 05:07:50
问题 I checked the accuracy of a segmentation method using the bboxPrecisionRecall function in Matlab version '9.4.0.857798 (R2018a) Update 2' and test result of an algorithm using IESK-ArDB dataset. The database is freely available here. Samples of database images and . I get 0s as output when trying to calculate the accuracy. What shall I do to get real results for my segmented algorithm? The Code is below: %% clean Workspace clear; clc; %% my segmented bounding box cell propied = {[48.5,84.5

Image segmentation in python

雨燕双飞 提交于 2021-02-07 08:00:33
问题 I have the image I am looking for python solution to break the shape in this image into smaller parts according to the contour in the image. I have looked into solution on Canny and findContours in OpenCV but none of them works for me. Edit: Code used: using Canny method import cv2 import numpy as np img = cv2.imread('area_of_blob_maxcontrast_white.jpg') edges = cv2.Canny(img, 100, 200) cv2.imwrite('area_of_blob_maxcontrast_white_edges.jpg',edges) using findContours method import numpy as np

Image segmentation in python

会有一股神秘感。 提交于 2021-02-07 07:59:40
问题 I have the image I am looking for python solution to break the shape in this image into smaller parts according to the contour in the image. I have looked into solution on Canny and findContours in OpenCV but none of them works for me. Edit: Code used: using Canny method import cv2 import numpy as np img = cv2.imread('area_of_blob_maxcontrast_white.jpg') edges = cv2.Canny(img, 100, 200) cv2.imwrite('area_of_blob_maxcontrast_white_edges.jpg',edges) using findContours method import numpy as np

Image segmentation in python

别说谁变了你拦得住时间么 提交于 2021-02-07 07:56:14
问题 I have the image I am looking for python solution to break the shape in this image into smaller parts according to the contour in the image. I have looked into solution on Canny and findContours in OpenCV but none of them works for me. Edit: Code used: using Canny method import cv2 import numpy as np img = cv2.imread('area_of_blob_maxcontrast_white.jpg') edges = cv2.Canny(img, 100, 200) cv2.imwrite('area_of_blob_maxcontrast_white_edges.jpg',edges) using findContours method import numpy as np