将图像分割成N个超像素后,我需要指定与一个超像素相邻或不相邻的超像素,并为所有超像素确定这种关系。
[L,NumLabels] = superpixels(A,200);
Run Code Online (Sandbox Code Playgroud)
如何为每个超像素指定相邻的超像素?
更新资料
我已经尝试了@Cris Luengo介绍的解决方案。但是出现了以下错误:
B=imread('H.jpg');
[L,N] = superpixels(B,200);
glcms=graycomatrix(L);
k=glcms(:,50); %SupNum=50
[r,~]=find(k>0);
aa=find(r==50);
r(aa)=[];
Run Code Online (Sandbox Code Playgroud)
更新2 我按照MATLAB帮助中的说明进行操作,但对我不起作用。对于SupNum = 8,产生了以下结果:
matlab image-processing image-segmentation matlab-coder superpixels
图像具有超像素的质心,是否有用于绘制区域邻接图的MATLAB函数?
L = superpixels(A, 200);
K=regionprops(L, 'Centroid'); % Detemining centroid coordinates of each superpixels
Run Code Online (Sandbox Code Playgroud)
PS类似但不是精确的解决方案:
https://www.mathworks.com/matlabcentral/fileexchange/16938-region-adjacency-graph-rag
https://www.mathworks.com/matlabcentral/fileexchange/53614-image-graphs
我对皮肤组织的多类分割感兴趣,我将 3000 个皮肤组织标签分为 4 个类别,我创建了一个 CNN 分类算法来训练我的分类模型。我想将分类模型用于新皮肤组织图像的分割任务,并对属于每个类的皮肤组织进行特征提取
以下是为训练我的分类模型而编写的代码
from tensorflow.keras.layers import Input, Concatenate, Dropout, Flatten, Dense, GlobalAveragePooling2D, Conv2D
from tensorflow.keras import backend as K
#from tensorflow.keras.utils import np_utils
from tensorflow.keras.utils import to_categorical
from tensorflow.keras.preprocessing.image import ImageDataGenerator
from tensorflow.keras import optimizers
from tensorflow.keras.metrics import top_k_categorical_accuracy
from tensorflow.keras.models import Sequential, Model, load_model
import tensorflow as tf
from tensorflow.keras.initializers import he_uniform
from tensorflow.keras.callbacks import ModelCheckpoint, LearningRateScheduler, TensorBoard, EarlyStopping, CSVLogger, ReduceLROnPlateau
#from tensorflow.compat.keras.backend import KTF
#import keras.backend.tensorflow_backend as KTF
from tensorflow.keras.applications.resnet50 import ResNet50
from …Run Code Online (Sandbox Code Playgroud) python image-segmentation multilabel-classification superpixels tensorflow
我们假设A是,
1 1 1 1 1 1
1 2 2 3 3 3
4 4 2 2 3 3
4 4 2 2 2 3
4 4 4 4 3 3
5 5 5 5 5 5
Run Code Online (Sandbox Code Playgroud)
我需要识别与特定强度值相邻的所有数字.例如,强度1,3和4与强度值2相邻.在Matlab中执行此操作的有效方法是什么?
我可以使用以下,
glcm = graycomatrix(A)
Run Code Online (Sandbox Code Playgroud)
但是如果A具有更大数量的强度值,例如10000灰度矩阵将不是有效的方法.
我将实现基于简单线性反馈控制系统(LFCS)的显着物体检测方法。控制系统模型表示为以下方程式:
我想出了以下程序代码,但结果不应该是这样。具体来说,输出应类似于下图:
代码如下。
%Calculation of euclidian distance between adjacent superpixels stores in variable of Euc
A = imread('aa.jpg');
[rows, columns, cnumberOfColorChannels] = size(A);
[L,N] = superpixels(A,400);
%% Determination of adjacent superpixels
glcms = graycomatrix(L,'NumLevels',N,'GrayLimits',[1,N],'Offset',[0,1;1,0]); %Create gray-level co-occurrence matrix from image
glcms = sum(glcms,3); % add together the two matrices
glcms = glcms + glcms.'; % add upper and lower triangles together, make it symmetric
glcms(1:N+1:end) = 0; % set the diagonal to zero, we don't want to see "1 …Run Code Online (Sandbox Code Playgroud) matlab image image-processing image-segmentation superpixels
我使用的regionprops从函数scikit-imagE(或skimage)包使用从同一个包SLIC超像素算法分割图像的计算区域的特性。
我需要比函数中计算的那些额外的特征,主要是:标准偏差、偏度、峰度。
我修改了_regionprops.py使用其他功能作为模板的源代码以包含这些属性:
@property
def sd_intensity(self):
return np.std(self.intensity_image[self.image])
@property
def skew_intensity(self):
return skew(self.intensity_image[self.image])
Run Code Online (Sandbox Code Playgroud)
我知道这是不好的做法,而不是一个长期的解决方案,因为我的代码将无法在另一台机器上运行,或者如果我更新 skimage。
我发现该函数skimage.measure.regionprops()有一个extra_properties=None参数,根据文档:
添加不包含在 skimage 中的额外属性计算函数。
我的问题是:我可以用 np.std 得到一个工作示例吗?我真的不知道如何使用这个参数。
谢谢
可以使用适当的索引手动指定位于图像边界的超像素(例如下面的示例用于第二个超像素L==2):
在某些情况下,需要以系统且非手动的方式指定位于图像边界中的所有那些超像素,类似于下面的图像:
有什么标准方法可以做到吗?
matlab image-processing boundary image-segmentation superpixels
我使用scikit图像库中的quickshift方法对我的图像进行了分割.如何计算超像素的平均颜色和面积?如何解释quickshift()方法的返回值?文档说返回值是"指示段标签的整数掩码",但这对我来说并不清楚.如何在原始图像的形状中制作一个布尔数组,其中包含特定超像素存在的布尔数组,在此演示文稿中,我的生活会更容易(我曾经在OpenCV中使用过这种类型的蒙版).你能帮帮我吗?我的代码(来自scikit-image网站的简化示例):
from skimage.data import astronaut
from skimage.segmentation import felzenszwalb, slic, quickshift
from skimage.segmentation import mark_boundaries
from skimage.util import img_as_float
img = img_as_float(astronaut()[::2, ::2])
segments_quick = quickshift(img, kernel_size=3, max_dist=6, ratio=0.5)
print("Quickshift number of segments: %d" % len(np.unique(segments_quick)))
plt.imshow(mark_boundaries(img, segments_quick))
plt.show()
Run Code Online (Sandbox Code Playgroud) python image-processing computer-vision scikit-image superpixels
我对通过能量驱动采样(SEEDS)提取的超像素感兴趣,这是一种使用超像素进行图像分割的方法.这也是OpenCV用于创建超像素的内容.我在查找SEEDS算法背后的文档时遇到了麻烦.OpenCV提供了一个非常一般的描述,可以在这里找到.
我正在寻找关于SEEDS功能的更深入的描述(无论是一般的演练还是数学解释).任何有关该算法的链接或想法将非常感谢!我似乎找不到任何好材料.谢谢!
superpixels ×9
matlab ×5
python ×3
scikit-image ×2
boundary ×1
image ×1
matlab-coder ×1
numpy ×1
opencv ×1
tensorflow ×1