| 222 | } |
| 223 | |
| 224 | QImage videoHandler::calculateDifference(FrameHandler * item2, |
| 225 | const int frameIdxItem0, |
| 226 | const int frameIdxItem1, |
| 227 | QList<InfoItem> &differenceInfoList, |
| 228 | const int amplificationFactor, |
| 229 | const bool markDifference) |
| 230 | { |
| 231 | // Try to cast item2 to a videoHandler |
| 232 | videoHandler *videoItem2 = dynamic_cast<videoHandler *>(item2); |
| 233 | if (videoItem2 == nullptr) |
| 234 | { |
| 235 | // The item2 is not a videoItem but this one is. |
| 236 | if (currentImageIndex != frameIdxItem0) |
| 237 | loadFrame(frameIdxItem0); |
| 238 | // Call the FrameHandler implementation to calculate the difference |
| 239 | return FrameHandler::calculateDifference(item2, |
| 240 | frameIdxItem0, |
| 241 | frameIdxItem1, |
| 242 | differenceInfoList, |
| 243 | amplificationFactor, |
| 244 | markDifference); |
| 245 | } |
| 246 | |
| 247 | // Load the right images, if not already loaded) |
| 248 | if (currentImageIndex != frameIdxItem0) |
| 249 | loadFrame(frameIdxItem0); |
| 250 | if (videoItem2->currentImageIndex != frameIdxItem1) |
| 251 | videoItem2->loadFrame(frameIdxItem1); |
| 252 | |
| 253 | return FrameHandler::calculateDifference( |
| 254 | item2, frameIdxItem0, frameIdxItem1, differenceInfoList, amplificationFactor, markDifference); |
| 255 | } |
| 256 | |
| 257 | QRgb videoHandler::getPixelVal(int x, int y) |
| 258 | { |