当前位置:网站首页>Matlab label2idx function (convert the label matrix into a cell array with linear index)
Matlab label2idx function (convert the label matrix into a cell array with linear index)
2022-07-05 11:58:00 【**inevitable**】
List of articles
grammar
pixelIndexList = label2idx(L)
explain
pixelIndexList = label2idx(L)
% The label matrix L The described area is converted to a linear index pixelIndexList.
Example
Calculate the pixel index list of the small label matrix
% Create a small sample matrix with three areas
BW = logical([1 1 1 0 0 0 0 0
1 1 1 0 1 1 0 0
1 1 1 0 1 1 0 0
1 1 1 0 0 0 0 0
1 1 1 0 0 0 1 0
1 1 1 0 0 0 1 0
1 1 1 0 0 1 1 0
1 1 1 0 0 0 0 0]);
% Create a label matrix from this sample image
L = bwlabel(BW)
% Get the linear index list of all pixels in each region
% This function returns an array of cells , The array has elements of each region found in the label matrix
pixelIndexList = label2idx(L)
% Check one of the returned pixel index lists
% for example , View the second cell in the returned cell array
% It contains information marked as “ 2” Linear index of all pixels in the region of
% The upper left corner of this area is pixels BW(2,5), It is the th in the linear index 34 Pixel
pixelIndexList{2}
Input parameters
L : Label matrix
Label matrix , An array of numbers specified as any dimension .
data type :single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | logical
Output parameters
pixelIndexList : Linear index of pixels in the region
Linear index of pixels in the region , With 1×n Cell array returns . Every element of the output pixelIndexList {n} It's a vector , It includes L All linear indexes in , among L be equal to n.
边栏推荐
- XML parsing
- Codeworks 5 questions per day (1700 average) - day 5
- Halcon template matching actual code (I)
- Network five whip
- Halcon 模板匹配实战代码(一)
- 【SingleShotMultiBoxDetector(SSD,单步多框目标检测)】
- [singleshotmultiboxdetector (SSD, single step multi frame target detection)]
- Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in
- Principle and performance analysis of lepton lossless compression
- pytorch-多层感知机MLP
猜你喜欢
随机推荐
Error modulenotfounderror: no module named 'cv2 aruco‘
你做自动化测试为什么总是失败?
一类恒等式的应用(范德蒙德卷积与超几何函数)
Principle of redis cluster mode
How can China Africa diamond accessory stones be inlaid to be safe and beautiful?
redis集群中hash tag 使用
Sentinel sentinel mechanism of master automatic election in redis master-slave
[singleshotmultiboxdetector (SSD, single step multi frame target detection)]
【无标题】
Halcon template matching actual code (I)
[crawler] bugs encountered by wasm
【主流Nivida显卡深度学习/强化学习/AI算力汇总】
C operation XML file
Redis master-slave mode
redis主从模式
Dynamic SQL of ibatis
Solve the grpc connection problem. Dial succeeds with transientfailure
【 YOLOv3中Loss部分计算】
pytorch-softmax回归
13.(地图数据篇)百度坐标(BD09)、国测局坐标(火星坐标,GCJ02)、和WGS84坐标系之间的转换