SDC C-Project CF Review 프로그램
LYW
2021-08-25 03152a241b9463c582b56896f5f5f73717497ab4
Ongoing100 #3486 CF AOI Review Review History 프로그램 테스트 및 적용

1.검사이미지 회전 기능 추가
3개 파일 변경됨
77 ■■■■■ 파일 변경됨
ReviewHistory/ReveiwHistory/ReveiwHistoryDlg.cpp 70 ●●●●● 패치 | 보기 | raw | blame | 히스토리
ReviewHistory/ReveiwHistory/ReveiwHistoryDlg.h 7 ●●●●● 패치 | 보기 | raw | blame | 히스토리
ReviewHistory/bin/ReviewHistroy.exe 패치 | 보기 | raw | blame | 히스토리
ReviewHistory/ReveiwHistory/ReveiwHistoryDlg.cpp
@@ -279,7 +279,15 @@
//             // 그림을 Picture Control 크기로 화면에 출력한다.
//             m_ReviewImage.Draw(dc, m_picture_rect);
//         }
        if (!m_DefectImage.IsNull())
        //LYW 20210825 #3486 ADD START
        if (!m_DefectRotateImage.IsNull())
        {
            dc.SetStretchBltMode(COLORONCOLOR);
            // 그림을 Picture Control 크기로 화면에 출력한다.
            m_DefectRotateImage.Draw(dc, m_picture_rect2);
        }
        //LYW 20210825 #3486 ADD END
        else if (!m_DefectImage.IsNull())
        {
            dc.SetStretchBltMode(COLORONCOLOR);
            // 그림을 Picture Control 크기로 화면에 출력한다.
@@ -1968,6 +1976,9 @@
    m_DefectImage.Destroy();
    m_ReviewImage.Destroy();
    //LYW 20210825 #3486 ADD START
    m_DefectRotateImage.Destroy();
    //LYW 20210825 #3486 ADD END
    m_AlignFirst.Destroy();
    m_AlignSecend.Destroy();
@@ -2055,7 +2066,7 @@
    DeftectPath.Format(_T("%s\\%s\\%s"), strReviewPath, strReviewImagePath, strReviewImageName);
    //DeftectPath2.Format(_T("%s\\%s"), strInspectorPath, strInspectorName);
    if (strInspectorName == "*" || strInspectorName == "**" || strInspectorName == "***") strInspectorName = "";
    DeftectPath2.Format(_T("%s\\%s\\%s"), strInspectorPath, pImageInfo->m_strGlassID, strReviewImageName);
    DeftectPath2.Format(_T("%s\\%s\\%s"), strInspectorPath, pImageInfo->m_strGlassID, strInspectorName);
    AlignPath.Format(_T("%s\\%s\\%s"), strAlignPath, pImageInfo->m_strGlassID, strAlignName);
    AlignPath2.Format(_T("%s\\%s\\%s"), strAlignPath, pImageInfo->m_strGlassID, strAlignName2);
@@ -2096,13 +2107,21 @@
    if (CFile::GetStatus(DeftectPath2, FileOn) && strInspectorName != "") //파일이 있을 때
    {
        m_DefectImage.Load(DeftectPath2);
        //LYW 20210825 #3486 ADD START
        m_DefectRotateImage.Create(m_DefectImage.GetWidth(), m_DefectImage.GetHeight(), m_DefectImage.GetBPP(), 0);
        ImageRotate(m_DefectImage, m_DefectRotateImage);
        //LYW 20210825 #3486 ADD END
        HBITMAP hBmp = (HBITMAP)::LoadImage(AfxGetInstanceHandle(), DeftectPath2,
            IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION);
        InvalidateRect(m_picture_rect2, FALSE);
        dc.SetStretchBltMode(COLORONCOLOR);
        m_DefectImage.Draw(dc, m_picture_rect2);
        //LYW 20210825 #3486 MOD START
        m_DefectRotateImage.Draw(dc, m_picture_rect2);
        //LYW 20210825 #3486 MOD END
        //original
        //m_DefectImage.Draw(dc, m_picture_rect2);
    }
    else
    {
@@ -2490,6 +2509,9 @@
//    m_ReviewImage.Destroy();
    m_DefectImage.Destroy();
    //LYW 20210825 #3486 ADD START
    m_DefectRotateImage.Destroy();
    //LYW 20210825 #3486 ADD END
    m_AlignFirst.Destroy();
    m_AlignSecend.Destroy();
@@ -2527,6 +2549,48 @@
    m_AlignSecend.Draw(dc, m_Align_rect2);
}
//LYW 20210825 #3486 ADD START
void CReveiwHistoryDlg::ImageRotate(CImage & SrcImage, CImage & DstImage, double degree/* = 180.0 */)
{
    int Height = SrcImage.GetHeight(); // 세로 길이 저장
    int Width = SrcImage.GetWidth(); // 가로 길이 저장
    int new_x, new_y;
    int R, G, B;
    int center_x = (SrcImage.GetWidth() / 2); // 회전 중심점
    int center_y = (SrcImage.GetHeight() / 2); // 회전 중심점
    double seta = 3.14 / (180.0 / degree); // 라디안
    double CosSeta = cos(seta);
    double SinSeta = sin(seta);
    for (int y = 0; y < Height; y++)
    {
        for (int x = 0; x < Width; x++)
        {
            new_x = (int)((x - center_x) * CosSeta - (y - center_y) * SinSeta + center_x);
            new_y = (int)((x - center_x) * SinSeta + (y - center_y) * CosSeta + center_y);
            if ((new_x < 0) || (new_x > Width) || (new_y < 0) || (new_y > Height))
                //이미지 범위를 벗어나면 0 값
            {
                R = 0;
                G = 0;
                B = 0;
            }
            else
            {
                R = GetRValue(SrcImage.GetPixel(new_x, new_y));
                G = GetGValue(SrcImage.GetPixel(new_x, new_y));
                B = GetBValue(SrcImage.GetPixel(new_x, new_y));
            }
            DstImage.SetPixel((int)x, (int)y, RGB(R, G, B));
            new_x = 0; new_y = 0;
        }
    }
}
//LYW 20210825 #3486 ADD END
void CReveiwHistoryDlg::OnChangeEditFileCount()
{
    // TODO:  RICHEDIT 컨트롤인 경우, 이 컨트롤은
ReviewHistory/ReveiwHistory/ReveiwHistoryDlg.h
@@ -83,6 +83,9 @@
    std::vector<_akDefect> m_vectest;
    CImage m_DefectImage;
    //LYW 20210825 #3486 ADD START
    CImage m_DefectRotateImage;
    //LYW 20210825 #3486 ADD END
    CImage m_ReviewImage;
    CRect m_picture_rect;
@@ -240,6 +243,10 @@
    void Imagenoload();
    //LYW 20210825 #3486 ADD START
    void ImageRotate(CImage& SrcImage, CImage& DstImage, double degree = 180.0);
    //LYW 20210825 #3486 ADD END
    BOOL GetCheckFileLoad(int nCount);
    void GlassInfoRest();
ReviewHistory/bin/ReviewHistroy.exe
Binary files differ