[DIP] CV2.INTER_AREA
·
Programming/DIP
CV2.INTER_AREACV2.INTER_AREA는 OpenCV 라이브러리에서 제공하는 image interpolation 방법 중 하나임. 주요특징과 작동방식 주요 특징과 작동 방식은 다음과같음:목적:주로 이미지를 축소(downsampling or shrinking)할 때 사용됨.pixel area 관계를 사용하여 새로운 픽셀 값을 계산.작동 원리:소스 이미지의 pixel area을 목표 이미지의 pixel area에 매핑.각 목표 픽셀에 대해, 해당하는 소스 이미지의 픽셀들의 평균값을 계산하여 채움.특징:모아레(Moiré) 패턴을 줄이는 데 효과적.이미지 축소 시 선명도를 잘 유지함.성능:이미지 축소 시 다른 방법들보다 좋은 결과를 제공함.확대 시에는 nearest-neighbor interpola..
[DIP] Interpolation (on Image)
·
Programming/DIP
Interpolation (on Image)measure 되지 못한 or 모르는 pixel(or sample)의 값을 주변의 pixel(or sample)들을 이용하여 구하는 과정.Given ($x_0$, $y_0$ ), ( $x_1$ , $y_1$), $\cdots$ ($x_n$, $y_n$), find the value of $y$ at a value of $x$ that is not given단, Interpolation으로 얻어진 inerpolant의 경우, 주어진 주변의 pixel 값들을 정확히 그대로 재현해야함.일반적인 fitting 또는 approximation과 가장 큰 차이점이 바로 이 것임.또한 interplation으로 추정되는 값들은 항상 주어진 값들의 사이에 존재한다 (extrap..
[DIP] Image Morphing (Simple)
·
Programming/DIP
Image Morphing은 한 이미지에서 다른 이미지로 부드럽게 전환하는 기술 두 image간에 대응되는 특징점들을 추출하여 mesh를 만들고 이들을 이용하여 부드럽게 전환이 되도록하는 게 일반적이지만,다음은 alpha-blending만을 이용한 아주 간단한 방법임.https://dsaint31.me/mkdocs_site/DIP/cv2/ch01/dip_1_04/ BMEImage Blending (or alpha Blending) 이것도 이미지 더하기 의 일종이지만, 이미지에 다른 가중치(\(\alpha\))를 부여하여 Blending 또는 transparency (투명감) 느낌을 부여함. 이는 아래 수식에 따라 더해짐: \[ g(i,jdsaint31.meExampleimport cv2import osd..
[OpenCV] bitwise op.
·
Programming/DIP
Bitwise Operations: AND, OR, NOT, XOR 연산자를 OpenCV가 제공.주로 특정 영역(사각형 모양이 아닌)을 추출하는데 사용됨.True의 representative value는 1이지만, uint8의 경우 255를 사용함.False의 representative value는 0이지만, uint8의 경우도 마찬가지임.https://gist.github.com/dsaint31x/a9ca880a91bceee901d0cce4903c6f4c cv_binary_op.ipynbcv_binary_op.ipynb. GitHub Gist: instantly share code, notes, and snippets.gist.github.com종류:cv2.bitwise_and()cv2.bitwise_..
[DIP] Image 다루기: cv2-기본편 1 (Summary)
·
Programming/DIP
openCV를 통한 이미지를 다루기 위한 기본 내용Pillow는 다음을 참고:https://ds31x.tistory.com/465 Pillow 사용법 - Basic 01Pillow 라이브러리의 기본적인 사용법을 다룬다. 2024.06.03 - [Python] - [Python] PIL, Pillow, OpenCV, and Scikit-image [Python] PIL, Pillow, OpenCV, and Scikit-imagePIL, Pillow, OpenCV, and Scikit-imagePython에서 이미지를 다룰 때ds31x.tistory.com1. image 파일로 저장더보기2024.09.22 - [Programming/DIP] - [DIP] cv2.imwrite [DIP] cv2.imwrite..
[DIP] cv2.imwrite
·
Programming/DIP
cv2.imwrite는 OpenCV 라이브러리에서 제공하는 "이미지 데이터를 지정한 파일로 저장하는 기능"을 수행. OpenCV 는 다양한 image format을 지원하며, 저장할 파일명의 확장자에 따라 알아서 encoding을 수행.사용법cv2.imwrite(filepath, img, params=None) -> boolfilepath:저장할 파일의 경로와 이름을 나타내는 str 객체.파일 extension을 통해 저장될 이미지의 format이 결정됨.예: 'image.png', 'image.jpg'img:저장할 이미지 데이터.일반적으로 NumPy 배열 형태로 제공 (dtype를 np.uint8로 주로 사용.)params (optional):이미지 저장 시 추가적인 파라미터를 설정 담당.key와 va..