Error with IF syntax invalid

-2

I'm creating this function in Python:

def myThreshold(I,p):
    Ibn = I;
    if((p > 0) && (p < 256))
    index = find(I >= p);
    lbn = lbn * 0;
    lbn(index) = 255;

    return lbn

but on the line of the if an error appears that says that the syntax is not valid, what am I failing?

Thanks

    
asked by Basilio Saldarriaga 26.09.2018 в 21:11
source

1 answer

2

Try something like the following:

def myThreshold(I,p):
    Ibn = I                   # <-- ?
    if 0 < p < 256:
        index = find(I >= p)
        lbn = lbn * 0         # <-- ?
        lbn(index) = 255      # <-- ?
    return lbn

Although lbn(index) is being called as if it were a function, however, in the previous line you assign a value that, in case of holding a number ( int or float ) lbn would become zero .

Also, you are declaring the variable Ibn within the body of the function and in no other line you use it.

    
answered by 26.09.2018 / 23:09
source