Arithmetic and Logic Operations
Functional Guide | Reference: Oper
//////////////////////////////////////////////////////// // This code snippet shows how to apply miscellaneous // // arithmetic and logic operations to images. // //////////////////////////////////////////////////////// // Images constructor EImageBW8 srcGray0, srcGray1, dstGray; EImageC24 srcColor, dstColor; // ... // All images must have the same size dstGray.SetSize(&srcGray0); // ... // Subtract srcGray1 from srcGray0 EasyImage::Oper(EArithmeticLogicOperation_Subtract, &srcGray0, &srcGray1, &dstGray); // Multiply srcGray0 by a constant value EasyImage::Oper(EArithmeticLogicOperation_Multiply, &srcGray0, (EBW8)2, &dstGray); // Add a constant value to srcColor EasyImage::Oper(EArithmeticLogicOperation_Add, &srcColor, EC24(128,64,196), &dstColor); // Erase (blacken) the destination image where the source image is black EasyImage::Oper(EArithmeticLogicOperation_SetZero, &srcGray0, (EBW8)0, &dstGray);
//////////////////////////////////////////////////////// // This code snippet shows how to apply miscellaneous // // arithmetic and logic operations to images. // //////////////////////////////////////////////////////// // Images constructor EImageBW8 srcGray0= new EImageBW8(); EImageBW8 srcGray1= new EImageBW8(); EImageBW8 dstGray= new EImageBW8(); EImageC24 srcColor= new EImageC24(); EImageC24 dstColor= new EImageC24(); EBW8 bw8Constant = new EBW8(2); EC24 c24Constant = new EC24(128, 64, 196); // ... // All images must have the same size dstGray.SetSize(srcGray0); dstColor.SetSize(srcColor); // Subtract srcGray1 from srcGray0 EasyImage.Oper(EArithmeticLogicOperation.Subtract, srcGray0, srcGray1, dstGray); // Multiply srcGray0 by a constant value EasyImage.Oper(EArithmeticLogicOperation.Multiply, srcGray0, bw8Constant, dstGray); // Add a constant value to srcColor EasyImage.Oper(EArithmeticLogicOperation.Add, srcColor, c24Constant, dstColor); // Erase (blacken) the destination image where the source image is black bw8Constant.Value = (byte)0; EasyImage.Oper(EArithmeticLogicOperation.SetZero, srcGray0, bw8Constant, dstGray);