## Logical OR & NOR

 Background The OR binary operation takes two binary inputs and outputs 0 only when both the inputs are 0 and if at least one input is 1 then it outputs 1. The NOR binary operator is the complete inverse of the AND binary operation. NOR outputs 1 when both the inputs are 0, else it produces 0. The functionality of OR and NOR are clarified by the help of the truth tables: OR NOR Using OR and NOR boolean algebra allows you to represent things like: He will be at home or in office. Understanding OR & NOR Mathematically: The ORing of two images is carried out by performing OR operation to the corresponding images of the two images to produce the output pixel value. For instance, suppose that we wish to AND the integers 167 and 211 together using 8-bit integers. 167 is 10100111 in binary and 255 is 11010011. ORing these together in bitwise fashion, we have 11110111 in binary or 247 in decimal. This is not at all the only implementation of this of the logical operators rather you can implement the logical ORing and NORing using some thresholding to transform the digital image data into the binary format, or simply by taking the 0 pixel value as the logical 0 and the non-zero pixel values as the logical 1 value. General Working The OR and NOR operations are performed through a single pass module which during operation passes through the each pixel of each image and calculates the pixels of the output image by doing the respective operation on the corresponding pixels to calculate the output pixels. It is necessary to have two images of the identical size. In the sample program, if two images are not identical in size, then they are made of the same size ( explained below). Guidelines for Use We can illustrate the function of the OR operator using and The images show a scene with two objects, one of which was moved between the exposures. We can use OR to compute the union of the images, i.e. highlighting all pixels which represent an object either in the first or in the second image. First, we threshold the images, since the process is simplified by use binary input. If we OR the resulting images and we obtain applying OR operator on the image and we obtain applying NOR operator C# Sample Program: The algorithm is coded in C# using unsafe so the quality and speed of the program may not be affected. The class BitmapData is used to read and process the pixels in the image. This is the speicality of C# to provide such a speed even on image processing applications. There is a set of modules that are designed to implement the algorithm. The program expects that the input images are grayscaled. Then it takes the BitmapData objects of the two input images. It determines which image is bigger in width as well as in height. Then it scales the smaller image to acquire the size of the bigger image to make the sizes of both the images equal. Then the algorithm calculates the ORed image in the single pass through the image. The final output is an image showing the result of the effect of OR operator on the two input images which is then displayed on the screen in the down most picture box.
• 0 Users Found This Useful

### Related Articles

Basic Image Processing in Csharp

The C# provides a good support for processing on the image, and the purpose of this article...

Implementation Of Branch And Bound Algorithm

What is Branch and Bound Algorithm? These notes follow the discussion of branch and...

Implementation of Calculating the RTS Invariant Moments Of Area

Why Using Moments of Area? It is seen that the usage of moments of area highly...

Conversion of a Color Image to a Grayscale Image

What is a Color Image? It is possible to construct (almost) all visible colors by...

GrayLevel Image Contras Stretching in C#

Overview Contrast stretching (often called normalization) is a simple image...