Changeset 20858

Show
Ignore:
Timestamp:
10/06/08 23:09:47 (3 months ago)
Author:
schima
Message:

二値化のNiblackの手法とSauvolaの手法を独自に実装。(かなり微妙、遅い)

Location:
lang/cpluspluscli/OpenCvSharp/trunk/OpenCvSharp
Files:
2 added
2 modified

Legend:

Unmodified
Added
Removed
  • lang/cpluspluscli/OpenCvSharp/trunk/OpenCvSharp/OpenCvSharp.vcproj

    r20286 r20858  
    208208                        </File> 
    209209                        <File 
     210                                RelativePath=".\Extras.cpp" 
     211                                > 
     212                        </File> 
     213                        <File 
    210214                                RelativePath=".\OpenCV.cpp" 
    211215                                > 
     
    426430                        > 
    427431                        <File 
     432                                RelativePath=".\Extras.h" 
     433                                > 
     434                        </File> 
     435                        <File 
    428436                                RelativePath=".\ICvObject.h" 
    429437                                > 
  • lang/cpluspluscli/OpenCvSharp/trunk/OpenCvSharp/WriteableBitmapConverter.cpp

    r17367 r20858  
    4949        } 
    5050                N::IplImage^ ipl = OpenCV::cvCreateImage(N::CvSize(w, h), (BitDepth)depth, channels); 
     51                byte* p = (byte*)(void*)ipl->ImageData; 
     52                 
    5153 
    52         // bpp1�͎��ƂŃR�s�[ 
     54        // 1bpp�͎��ƂŃR�s�[ 
    5355        if (bpp == 1) { 
    5456            // BitmapImage�̃f�[�^���R�s�[ 
    55             // �v�f1�‚ɉ�8�s�N�Z�����̃f�[�^������� 
    56             int stride = (w / 8) + 1; 
    57             array<Byte>^ pixels = gcnew array<Byte>(h * stride); 
    58             src->CopyPixels(pixels, stride, 0); 
    59             byte* p = (byte*)(void*)ipl->ImageData; 
     57            // �v�f1�‚ɉ�8�s�N�Z�����̃f�[�^�������    
     58                        int stride = (w / 8) + 1; 
     59                        array<Byte>^ pixels = gcnew array<Byte>(h * stride); 
     60                        src->CopyPixels(pixels, stride, 0); 
    6061            int offset = 0; 
    6162            int x = 0; 
     
    8687                x = 0; 
    8788            } 
    88  
     89                // 8bpp 
     90                } else if(bpp == 8){ 
     91                        int stride = w; 
     92                        array<Byte>^ pixels = gcnew array<Byte>(h * stride); 
     93                        src->CopyPixels(pixels, stride, 0); 
     94                        for (int y=0; y<h; y++) { 
     95                                for(int x=0; x<w; x++){ 
     96                                        p[ipl->WidthStep * y + x] = pixels[y * stride + x]; 
     97                                } 
     98            } 
    8999        } else { 
    90100            int stride = w * ((bpp + 7) / 8); 
     
    164174            } 
    165175            dst->WritePixels(Int32Rect(0, 0, w, h), pixels, stride, 0); 
    166         } else { 
     176 
     177                /*} else if(bpp == 8){ 
     178                        int stride = w; 
     179                        array<Byte>^ pixels = gcnew array<Byte>(h * stride); 
     180            byte* p = (byte*)(void*)src->ImageData; 
     181                        for (int y=0; y<h; y++) { 
     182                                for(int x=0; x<w; x++){ 
     183                                        pixels[y * stride + x] = p[src->WidthStep * y + x]; 
     184                                } 
     185            } 
     186                        dst->WritePixels(Int32Rect(0, 0, w, h), pixels, stride, 0); 
     187 
     188        */} else { 
    167189            dst->WritePixels(Int32Rect(0, 0, w, h), src->ImageData, src->ImageSize, src->WidthStep); 
    168190        }