[DIP] Image 다루기: cv2-기본편 3 (Summary)

2024. 9. 22. 19:58·Programming/DIP
728x90
728x90

openCV를 통한 이미지를 다루기 위한 기본 내용 (3)

 


1. Basic Operations

image pixel 값에 접근하기: 개별접근과 slicing

  • NumPy의 FancyIndexing이나 mask를 이용한 방식에 대한 이해하고 있는 것이 중요함
더보기

https://dsaint31.me/mkdocs_site/DIP/cv2/ch01/dip_1_01/#pixel

 

BME

Basic Operations on Images 목표 pixel의 intensity 또는 color vector의 값을 읽거나 수정하기. image의 property들을 확인하기 ROI 설정하기. image를 여러 축으로 나누거나 합치기. OpenCV의 Python Binding에서 기본 데이

dsaint31.me

 

다음은 NumPy 외에 ndarray에 해당하는 Tensor의 요소를 indexing하는 방법을 다루는 글임 (시간있다면 같이 익혀두길 권함)

https://ds31x.tistory.com/220

 

[DL] Tensor: Indexing <Simple, Slicing, Fancy, Boolean Mask>

NumPy나 PyTorch, Tensorflow의 텐서들도파이썬의 list 또는 tubple 에서의 indexing과 slicing이 거의 그대로 사용됨.2023.07.12 - [Python] - [Python] list (sequence type) : summary [Python] list (sequence type) : summarylist는 ordered m

ds31x.tistory.com



image attributes 접근하기

  • shape 나 dtype 등등.
더보기

https://dsaint31.me/mkdocs_site/DIP/cv2/ch01/dip_1_01/#accessing-image-properties

 

BME

Basic Operations on Images 목표 pixel의 intensity 또는 color vector의 값을 읽거나 수정하기. image의 property들을 확인하기 ROI 설정하기. image를 여러 축으로 나누거나 합치기. OpenCV의 Python Binding에서 기본 데이

dsaint31.me



2. ROI Processing

callback을 이용한 구현.

더보기

2022.10.03 - [Programming/DIP] - [DIP] opencv : Region of Interest (ROI) :

 

[DIP] OpenCV : Region of Interest (ROI) : Callback으로 구현.

cv2.selectROI가 아닌 이벤트 핸들러(MouseCallback)를 이용한 구현임.x button (or close button)을 지원하기 위한 구현을 추가.x 키를 누를 경우, roi를 보여주는 창만 닫히도록 처리함.esc 키를 누를 경우, 프로

dsaint31.tistory.com



cv2.selectROI 를 이용한 구현.

더보기

2022.10.03 - [Programming/DIP] - [DIP] opencv : Region of Interest (ROI) : cv2.selectROI

 

[DIP] opencv : Region of Interest (ROI) : cv2.selectROI

cv2에서 사각형의 ROI를 선택하는 가장 쉬운 방법. ret_val = cv2.selectROI([window_name], img [, showCrossHair=True, fromCenter=False] window_name : ROI 선택을 수행할 window이름. str img : 보여질 이미지. showCrossHair : ROI 중

dsaint31.tistory.com



3. Splitting and Merging

Image Channels 에 적용하기

더보기

https://dsaint31.me/mkdocs_site/DIP/cv2/ch01/dip_1_01/#splitting-and-merging-image-channels

 

BME

Basic Operations on Images 목표 pixel의 intensity 또는 color vector의 값을 읽거나 수정하기. image의 property들을 확인하기 ROI 설정하기. image를 여러 축으로 나누거나 합치기. OpenCV의 Python Binding에서 기본 데이

dsaint31.me



이미지 합치기, 나누기: 채널 외의 축에 적용하기

더보기

2021.09.11 - [Programming/DIP] - NumPy 배열 병합 : 영상 붙이기

 

NumPy 배열 병합 : 영상 붙이기

1. numpy.vstack numpy.vstack(tup) : Stack arrays in sequence vertically (rowwise) axis 0로 ndarray들을 붙임 2d image라면 위아래로 붙여지게 됨. Simple example import numpy as np a = np.ones((4,3)) b = np.zeros((4,3)) np.vstack( (a,b) ) Image

dsaint31.tistory.com

2021.09.11 - [Programming/DIP] - NumPy 배열 나누기: 영상 자르기

 

NumPy 배열 나누기: 영상 자르기

1. numpy.vsplit numpy.vsplit(array, indices_or_sections) : Split an array into multiple sub-arrays vertically (row-wise) axis 0 (행)로 array를 잘라 나눔. array가 image라면 수직으로 잘려진다. Simple example import numpy as np a = np.arange

dsaint31.tistory.com



4. Image Padding

  • DIP에서 주변부의 정보를 유지하기 위해선 padding이 필요함.
더보기

https://dsaint31.me/mkdocs_site/DIP/cv2/ch01/dip_1_02/

 

BME228

OpenCV에서 Padding image를 특정 사이즈로 padding해야할 경우에는 cv2.copyMakeBorder() 함수를 사용하면 된다. ret = cv2.copyMakeBorder(src, top, bottom, left, right, padding_type, value) src : input image top : 위로 padding할 pixel

dsaint31.me



5. 사칙연산

  • 이미지에 기본적인 연산을 수행하는 방법을 소개
  • NumPy의 연산을 보다 선호하지만, [0,255] 범위로 제한된 처리를 위해서 openCV에서 제공하는 기능을 쓰기도 함.
  • 차이점 주의할 것
더보기

https://dsaint31.me/mkdocs_site/DIP/cv2/ch01/dip_1_03/

 

BME

Arithmetic Operations on Images Goal Image에 적용가능한 다음의 연산들을 소개함. addition, subtraction, bitwise operations etc. NumPy와 OpenCV의 차이점을 확인할 것. Image Addition 두 이미지를 더하는 방법 OpenCV의 cv2.add

dsaint31.me

위의 내용을 위해선 seaborn 라이브러리가 필요함.



6. Scaling (Zooming and Shrinking) and Interpolation ***

  • 영상의 크기 변경
더보기

https://dsaint31.me/mkdocs_site/DIP/cv2/ch02/dip_geometric_transformation/#scaling

 

BME

Geometric Transformations of Images Goals Learn to apply different geometric transformation to images like translation, rotation, affine transformation etc. You will see these functions: cv2.getPerspectiveTransform Transformations Transformation 이란? T

dsaint31.me

 

2024.09.22 - [Programming/DIP] - [DIP] Interpolation (on Image)

 

[DIP] Interpolation (on Image)

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$

dsaint31.tistory.com



7. Alpha Blending

더보기

https://dsaint31.me/mkdocs_site/DIP/cv2/ch01/dip_1_04/

 

BME228

Image Blending (or \(\alpha\) Blending) 이것도 이미지 더하기 의 일종이지만, 이미지에 다른 가중치(\(\alpha\))를 부여하여 Blending 또는 transparency (투명감) 느낌을 부여함. 이는 아래 수식에 따라 더해짐: \[

dsaint31.me

2024.09.22 - [Programming/DIP] - [DIP] Image Morphing (Simple)

 

[DIP] Image Morphing (Simple)

Image Morphing은 한 이미지에서 다른 이미지로 부드럽게 전환하는 기술 두 image간에 대응되는 특징점들을 추출하여 mesh를 만들고 이들을 이용하여 부드럽게 전환이 되도록하는 게 일반적이지만,다

dsaint31.tistory.com



8. Bitwise Op.

  • 이미지에서도 bitwise operator를 적용할 수 있음: Masking 등.
더보기

2024.09.22 - [Programming/DIP] - [OpenCV] bitwise op.

 

[OpenCV] bitwise op.

Bitwise Operations: AND, OR, NOT, XOR 연산자를 OpenCV가 제공.주로 특정 영역(사각형 모양이 아닌)을 추출하는데 사용됨.True의 representative value는 1이지만, uint8의 경우 255를 사용함.False의 representative value는

dsaint31.tistory.com



같이보면 좋은 자료들

2024.09.22 - [Programming/DIP] - [DIP] Image 다루기: cv2-기본편 1 (Summary)

 

[DIP] Image 다루기: cv2-기본편 1 (Summary)

openCV를 통한 이미지를 다루기 위한 기본 내용Pillow는 다음을 참고:https://ds31x.tistory.com/465 Pillow 사용법 - Basic 01Pillow 라이브러리의 기본적인 사용법을 다룬다. 2024.06.03 - [Python] - [Python] PIL, Pillow, Ope

dsaint31.tistory.com

 

 

'Programming > DIP' 카테고리의 다른 글

[DIP] Moirè (모아레) (and Beat)  (3) 2024.09.30
[DIP] cv2.convertSacleAbs(): contrast, brightness 수동조정  (0) 2024.09.23
[DIP] CV2.INTER_AREA  (0) 2024.09.22
[DIP] Interpolation (on Image)  (2) 2024.09.22
[DIP] Image Morphing (Simple)  (0) 2024.09.22
'Programming/DIP' 카테고리의 다른 글
  • [DIP] Moirè (모아레) (and Beat)
  • [DIP] cv2.convertSacleAbs(): contrast, brightness 수동조정
  • [DIP] CV2.INTER_AREA
  • [DIP] Interpolation (on Image)
dsaint31x
dsaint31x
    반응형
    250x250
  • dsaint31x
    Dsaint31's blog
    dsaint31x
  • 전체
    오늘
    어제
    • 분류 전체보기 (748)
      • Private Life (13)
      • Programming (56)
        • DIP (112)
        • ML (26)
      • Computer (119)
        • CE (53)
        • ETC (33)
        • CUDA (3)
        • Blog, Markdown, Latex (4)
        • Linux (9)
      • ... (351)
        • Signals and Systems (103)
        • Math (172)
        • Linear Algebra (33)
        • Physics (42)
        • 인성세미나 (1)
      • 정리필요. (54)
        • 의료기기의 이해 (6)
        • PET, MRI and so on. (1)
        • PET Study 2009 (1)
        • 방사선 장해방호 (4)
        • 방사선 생물학 (3)
        • 방사선 계측 (9)
        • 기타 방사능관련 (3)
        • 고시 (9)
        • 정리 (18)
      • RI (0)
      • 원자력,방사능 관련법 (2)
  • 블로그 메뉴

    • Math
    • Programming
    • SS
    • DIP
  • 링크

    • Convex Optimization For All
  • 공지사항

    • Test
    • PET Study 2009
    • 기타 방사능관련.
  • 인기 글

  • 태그

    Convolution
    opencv
    SS
    Term
    function
    SIGNAL
    Python
    Probability
    math
    signals_and_systems
    cv2
    Vector
    signal_and_system
    fourier transform
    Programming
    numpy
    linear algebra
    Optimization
    DIP
    인허가제도
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.3
dsaint31x
[DIP] Image 다루기: cv2-기본편 3 (Summary)
상단으로

티스토리툴바