1

網膜写真のグレースケールのバッファー画像があります。Sobel および Canny アルゴリズムで処理した後、画像の周りにいくつかの短い線が残ります。これらの小さな線は、血管の幅を計算するために作成したアルゴリズムに影響を与えています。長さが N ピクセルよりも短いすべての行を削除するために使用できるアルゴリズムを作成するか、識別しようとしています。これにより、画像がきれいになるだけでなく、アルゴリズムがより効果的になります。この種の問題に対するアルゴリズムはありますか? そうでない場合、どこから始めるべきか誰か提案できますか? 1行を追跡するために次を作成しましたが、多くの作業が必要です:

public static IntImage cleanImage(IntImage imageIn) {
    int width = imageIn.nCols, height = imageIn.nRows;
    IntImage image = new IntImage(height, width);
    image.setPixels(imageIn.getPixels().clone());
    int currentX = 0, currentY = 0, currentValue = 0, count = 0, counter = 0;
    int[][] locations = new int[50][2];
    boolean connectionFound = false;

    for(int row = 0; row < height-1; row++){
        for(int col = 1; col < width-1; col++){
            currentX=col;
            currentY=row;
            do{
                if(image.getPixel(currentY, currentX)==255){
                    locations[count][0]=currentY;
                    locations[count][1]=currentX;
                    ++count;
                }else if(image.getPixel(currentY, currentX+1)==255){
                    locations[count][0]=currentY;
                    locations[count][1]=currentX+1;
                    ++count;
                    currentX+=1;
                }else if(image.getPixel(currentY+1, currentX+1)==255){
                    locations[count][0]=currentY+1;
                    locations[count][1]=currentX+1;
                    ++count;
                    currentY+=1;
                    currentX+=1;
                }else if(image.getPixel(currentY+1, currentX)==255){
                    locations[count][0]=currentY+1;
                    locations[count][1]=currentX;
                    ++count;
                    currentY+=1;
                }else if(image.getPixel(currentY+1, currentX-1)==255){
                        locations[count][0]=currentY+1;
                        locations[count][1]=currentX-1;
                        ++count;
                        currentY+=1;
                        currentX-=1;
                }else if(image.getPixel(currentY, currentX-1)==255){
                    locations[count][0]=currentY;
                    locations[count][1]=currentX-1;
                    ++count;
                    currentX-=1;
                }
            }while(image.getPixel(currentY, currentX)==255 && count < 50);
            if(count < 50){
                for(int loop = 0; loop < 50; loop++){
                    image.setPixel(locations[loop][0], locations[loop][1], 0);
                    locations[loop][0]=0;
                    locations[loop][1]=0;
                }
            }
            count = 0;
            currentX = col;
            currentY = row;
        }
    }
    return image;

上記のコードは、私が自分自身を試していることを示すためのものですが、多くの作業が必要であると言ったように、あまり気にしないでください。Sobel および Canny アルゴリズムを使用して血管の輪郭を取得し、画像をバイナリ画像に変換します。その時点で、他のすべての行が表示されます。この時点より前に画像を処理することはできません。私がソーベルなしでキャニーを使用するだけなら、それほど悪くはありませんが、線がはるかに広いように見えるため、この方法では不正確です. そのため、容器の縁の内側の領域が処理のために明確であることを確認するために、小さな線を削除したいと考えています. 残念ながら、私の評判は少なくとも 10 である必要があるため、写真をアップロードできません。ごめん。

4

0 に答える 0