且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

需要帮助理解这个MATLAB函数的实现

更新时间:2022-10-15 17:29:17

链 - code

  

A 链code 是一种无损COM pression   算法单色图像。该   链codeS的基本原理是   单独连接code分别连接   组件或印迹的形象。

     

有关每个这样的区域,的的边界上的点被选择并且其   坐标传送。

     

的EN codeR然后沿图像的边界移动,并在每个   步,再发射presenting的象征   此运动的方向。本   一直持续到EN codeR返回   起始位置,在该点   印迹已经完全   描述的,和编码继续与   图像中的下一个印迹强>

假设黑色正白(二进制)图像阵列,U试图形成图像的链 - code。

现在U可以检测的地区的的印迹强>,通过检查相邻像素为相同的值作为当前像素。这两种类型的邻接规则是4的连接和8的连接。

MOD函数

  code(计数)= MOD(索引+偏移,N);
 

返回在印迹的下一个象素的方向(或位移)(相对于当前像素)。

因此, N / 2 偏移 2 4 根据相邻ü要征收。

好运!!

Looking at this article ...

offset = N/2;       %offset between ajacent pixels

I don't understand what the above means?

Chain-code

A chain code is a lossless compression algorithm for monochrome images. The basic principle of chain codes is to separately encode each connected component, or "blot", in the image.

For each such region, a point on the boundary is selected and its coordinates are transmitted.

The encoder then moves along the boundary of the image and, at each step, transmits a symbol representing the direction of this movement. This continues until the encoder returns to the starting position, at which point the blot has been completely described, and encoding continues with the next blot in the image.

Assuming the Black-n-White (binary) Image-array, U are trying to form the chain-code of the image.

Now U can detect the the area of a "BLOT" by checking adjacent pixels for the same value as the current pixel. The two types of adjacency rules are 4 connectivity and 8 connectivity.

The mod function

code(count) = mod( index + offset, N);

returns the "direction" (or displacement) of the next pixel in the blot (relative to the current-pixel).

Hence the N/2 i.e. offset is either 2 or 4 depending on the adjacency U want to impose.

GoodLUCK!!