Skip to content

Data type required for EDT using PyDIP #179

Answered by crisluengo
shbrainard asked this question in General
Discussion options

You must be logged in to vote

Unlike OpenCV, in DIPlib we make a strong distinction between binary images and gray-scale images. Binary is a distinct type. I presume that your ONE.tif is an 8-bit unsigned integer image, then print(img1) will show you something like this:

    data type UINT8
    sizes {256, 256} (2D)
    strides {1, 256}, tensor stride 1
    data pointer:   0x104e76000 (shared among 1 images)
    origin pointer: 0x104e76000

You can query the data type using img1.DataType().

To convert a gray-scale image to binary, threshold it. In your example, you could do img1 = img1 > 0. You can also do img1.Convert('BIN'), use dip.Threshold(), etc. Now print(img1) shows something like this:

    data type BIN
    s…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by crisluengo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:PyDIP About the PyDIP Python interface
2 participants
Converted from issue

This discussion was converted from issue #42 on November 25, 2024 18:54.