mamba.convertByMask(imWrk4, imWrk3, 0, d) # Modulus and azimut are calculated. mamba.logic(imWrk2, imModul, imModul, "sup") mamba.logic(imWrk3, imAzim, imAzim, "sup") # Using this operator on a seismic section image. # Reading the initial image and defining results images. imA = mamba.imageMb("seismic_section.png") imB = mamba.imageMb(imA) imC = mamba.imageMb(imA) # Calculating the vectorial gradient. vectorGradient(imA, imB, imC) # A palette for displaying the 12 possible directions is defined. dirpal = (0, 0, 0, 255, 0, 0, 255, 128, 0, 255, 255, 0, 128, 255, 0, 0, 255, 0) dirpal += (0, 255, 128, 0, 255, 255, 0, 128, 255, 0, 0, 255) dirpal += (128, 0, 255, 255, 0, 255, 255, 0, 128) dirpal += 243 * (0, 0, 0) mambaDisplay.addPalette("direction palette", dirpal) # Saving the results. # Applying the new palette to the azimut image (and the classical # rainbow palette to the modulus). imB.save("gradient_modulus.png", palette=mambaDisplay.getPalette("rainbow")) imC.save("gradient_azimut.png", palette=mambaDisplay.getPalette("direction palette")) # The last line could have been # imC.save('gradient_azimut.png', palette=dirpal)
mamba.generateSupMask(imWrk2, imModul, imWrk4, True) mamba.convertByMask(imWrk4, imWrk3, 0, d) # Modulus and azimut are calculated. mamba.logic(imWrk2, imModul, imModul, "sup") mamba.logic(imWrk3, imAzim, imAzim, "sup") # Using this operator on a seismic section image. # Reading the initial image and defining results images. imA = mamba.imageMb('seismic_section.png') imB = mamba.imageMb(imA) imC = mamba.imageMb(imA) # Calculating the vectorial gradient. vectorGradient(imA, imB, imC) # A palette for displaying the 12 possible directions is defined. dirpal = (0, 0, 0, 255, 0, 0, 255, 128, 0, 255, 255, 0, 128, 255, 0, 0, 255, 0) dirpal += (0, 255, 128, 0, 255, 255, 0, 128, 255, 0, 0, 255) dirpal += (128, 0, 255, 255, 0, 255, 255, 0, 128) dirpal += 243 * (0, 0, 0) mambaDisplay.addPalette("direction palette", dirpal) # Saving the results. # Applying the new palette to the azimut image (and the classical # rainbow palette to the modulus). imB.save('gradient_modulus.png', palette=mambaDisplay.getPalette("rainbow")) imC.save('gradient_azimut.png', palette=mambaDisplay.getPalette("direction palette")) # The last line could have been # imC.save('gradient_azimut.png', palette=dirpal)
239, 255, 19, 243, 255, 15, 247, 255, 11, 251, 255, 7, 255, 255, 3, 255, 255, 0, 255, 251, 0, 255, 247, 0, 255, 243, 0, 255, 239, 0, 255, 235, 0, 255, 231, 0, 255, 227, 0, 255, 223, 0, 255, 219, 0, 255, 215, 0, 255, 211, 0, 255, 207, 0, 255, 203, 0, 255, 199, 0, 255, 195, 0, 255, 191, 0, 255, 187, 0, 255, 183, 0, 255, 179, 0, 255, 175, 0, 255, 171, 0, 255, 167, 0, 255, 163, 0, 255, 159, 0, 255, 155, 0, 255, 151, 0, 255, 147, 0, 255, 143, 0, 255, 139, 0, 255, 135, 0, 255, 131, 0, 255, 127, 0, 255, 123, 0, 255, 119, 0, 255, 115, 0, 255, 111, 0, 255, 107, 0, 255, 103, 0, 255, 99, 0, 255, 95, 0, 255, 91, 0, 255, 87, 0, 255, 83, 0, 255, 79, 0, 255, 75, 0, 255, 71, 0, 255, 67, 0, 255, 63, 0, 255, 59, 0, 255, 55, 0, 255, 51, 0, 255, 47, 0, 255, 43, 0, 255, 39, 0, 255, 35, 0, 255, 31, 0, 255, 27, 0, 255, 23, 0, 255, 19, 0, 255, 15, 0, 255, 11, 0, 255, 7, 0, 255, 3, 0, 255, 0, 0, 251, 0, 0, 247, 0, 0, 243, 0, 0, 239, 0, 0, 235, 0, 0, 231, 0, 0, 227, 0, 0, 223, 0, 0, 219, 0, 0, 215, 0, 0, 211, 0, 0, 207, 0, 0, 203, 0, 0, 199, 0, 0, 195, 0, 0, 191, 0, 0, 187, 0, 0, 183, 0, 0, 179, 0, 0, 175, 0, 0, 171, 0, 0, 167, 0, 0, 163, 0, 0, 159, 0, 0, 155, 0, 0, 151, 0, 0, 147, 0, 0, 143, 0, 0, 139, 0, 0, 135, 0, 0, 131, 0, 0 ) # And then add it to the palettes available for display mambaDisplay.addPalette("my palette", your_palette) # If you save at this point, you can apply the palette through the appropriate # argument im.save('snake_palette.png', palette=your_palette) # Now you can play with the display shortcuts # Try pressing P, it rotates through all the palettes including yours # Try zooming in or out with A and Z or with your mouse wheel # Try Ctrl-R to reset the display # Try pressing the right button of your mouse to spawn the contextual menu
255, 211, 0, 255, 207, 0, 255, 203, 0, 255, 199, 0, 255, 195, 0, 255, 191, 0, 255, 187, 0, 255, 183, 0, 255, 179, 0, 255, 175, 0, 255, 171, 0, 255, 167, 0, 255, 163, 0, 255, 159, 0, 255, 155, 0, 255, 151, 0, 255, 147, 0, 255, 143, 0, 255, 139, 0, 255, 135, 0, 255, 131, 0, 255, 127, 0, 255, 123, 0, 255, 119, 0, 255, 115, 0, 255, 111, 0, 255, 107, 0, 255, 103, 0, 255, 99, 0, 255, 95, 0, 255, 91, 0, 255, 87, 0, 255, 83, 0, 255, 79, 0, 255, 75, 0, 255, 71, 0, 255, 67, 0, 255, 63, 0, 255, 59, 0, 255, 55, 0, 255, 51, 0, 255, 47, 0, 255, 43, 0, 255, 39, 0, 255, 35, 0, 255, 31, 0, 255, 27, 0, 255, 23, 0, 255, 19, 0, 255, 15, 0, 255, 11, 0, 255, 7, 0, 255, 3, 0, 255, 0, 0, 251, 0, 0, 247, 0, 0, 243, 0, 0, 239, 0, 0, 235, 0, 0, 231, 0, 0, 227, 0, 0, 223, 0, 0, 219, 0, 0, 215, 0, 0, 211, 0, 0, 207, 0, 0, 203, 0, 0, 199, 0, 0, 195, 0, 0, 191, 0, 0, 187, 0, 0, 183, 0, 0, 179, 0, 0, 175, 0, 0, 171, 0, 0, 167, 0, 0, 163, 0, 0, 159, 0, 0, 155, 0, 0, 151, 0, 0, 147, 0, 0, 143, 0, 0, 139, 0, 0, 135, 0, 0, 131, 0, 0) # And then add it to the palettes available for display mambaDisplay.addPalette("my palette", your_palette) # If you save at this point, you can apply the palette through the appropriate # argument im.save('snake_palette.png', palette=your_palette) # Now you can play with the display shortcuts # Try pressing P, it rotates through all the palettes including yours # Try zooming in or out with A and Z or with your mouse wheel # Try Ctrl-R to reset the display # Try pressing the right button of your mouse to spawn the contextual menu