text:
# Warp Image Optical Flow Python

Optical flow estimation using the steered Hermite transform There have been previous approaches to motion estimation based on the Hermite transform. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. However, the state of the art with regard to the quality of the flow has still been defined by traditional methods. Before flow fields were recovered, the test sequences were reconstructed using relative composition of structural and textural parts from the original ima. The image warping technique, which was used in our study, is used to properly align the images of the same scene. / pyrfactor) **. Real-time Projector Depixelation for Videos Abstract The screen-door eﬁect or projector pixelation is a visual artifact produced by many digital projectors. To attenuate pixelation, we use the common defocusing ap-. Then it performs a weighted, least-square fit of the optical flow constraint equation to a constant model for [ u v ] T in each section Ω. Its accurate and efficient estimation is a long-standing difficult problem. There is also a smoothness term applied to the forward optical ﬂow. The trick to address this issue is to iterate the process of solving for u and v through alternating steps of solving and warping. Adaptive support -weight approach for correspondence search. A 3D-image capturing device implements distortion correction that has different correction precisions on images obtained according to an image capturing mode such as 3D video and 3D still images, and corrects optical axis shift by implementing on the image a stripping process that corresponds to an quantity of optical shift of left and right. Detailed Description. (b) The single ray image. So let's import the libraries and then we load the image. Dagstuhl Motion Workshop, 2008. (optical flow+ADV) that will be the input of a classifier. Multiple GPU training is supported, and the code provides examples for training or inference on MPI-Sintel clean and final datasets. Fei-Fei Li Lecture 14 - From’images’to’videos’ • A’video’is’asequence’of’frames’captured’over’3me’ • Now’our’image’datais. Optical Flow Motion Estimation Estimate the motion of objects in an image sequence. Even with multiple warps. Optical Flow. The code was originally conceived to operate over Matlab. #!/usr/bin/env python import cv2 import numpy as np if __name__ == '__main__' : # Read source image. Farneback Optical flow : camera moving check. line_descriptor. often useful to low-pass ﬁlter the images before motion estima-tion (for better derivative estimation, and somewhat better linear approximations to image intensity) 2503: Optical Flow Page: 14. Data are sequences of frame images. Optical flow • Recover image motion at each pixel from spatio-temporal image brightness variations (optical flow) Feature-tracking • Extract visual features (corners, textured areas) and “track” them over multiple frames • Shi-Tomasi feature tracker • Tracking with dynamics • Implemented in Open CV. The 1st assumption of Lucas Kanade is the brightness assumption, which assumes that the displaced pixel remains at the same brightness level. This is often done by computing the ow as the minimizer of an. We need to construct image pyramid: #from flow_huber_py import construct_image_pyramid def construct_image_pyramid(I, pyrlevels, pyrfactor): factor = 2. Recently I used successive over-relaxation (SOR) to replace conjugate gradient (CG) in solving the linear system and the code ran much faster! I developed some C++ optical flow code that can be used in MATLAB during my thesis. Besides the common grey value constancy assumption, also gradient constancy, as well as the constancy of the Hessian and the Laplacian are proposed. The code work well when I stitched using only two of your images, but gave the following errors when used more than 2 image. Indices and tables ¶. Warping of optical flow. - Repeat till convergence. Investigation on Combining 3D Convolution of Image Data and Optical Flow to Generate Temporal Action Proposals. The trick to address this issue is to iterate the process of solving for u and v through alternating steps of solving and warping. In this paper, we present a real-time projector depixela-tion framework for displaying high resolution videos. C++ code running under this call is extracted from the old version (pre Aug 1, 2011) of Ce Liu’s homepage and should give the exact same output as the Matlab equivalent. , A framework for the robust estimation of optical flow, Fourth International Conf. The first time the old and new frame will be the same, but the next run it should be two different frames. But I've no idea if that's possible or what kind of functions would work. 2s/frame, is signiﬁcantly more accurate than PCA-Flow, and achieves state-of-the-art performance in occluded regions on MPI-Sintel. Left: An image from the Prokudin-Gorskii Collection. But the movement of the sensor regains some of the 3D information that is beyond the data accessible from a single 2D image. Defaults to 'linear'. In this recipe, we will find out how to compute. Any idea how this is possible? I'm using python 2. But in step (5) we calculate multiplication of image gradient and this Jacobian - $\nabla I \frac{\partial W}{\partial p}$, and as far as I can see from the context (see, for example, Figure 2 on page 5), it is done for the whole image. interpolate_spline ) to interpolate the displacements between the corresponding control points to a dense flow field. Warped Optical-Flow Inter-Frame Reconstruction for Ultrasound Image Enhancement Article (PDF Available) in Journal of Computer Science 7(10):1532-1540 · January 2011 with 118 Reads. • Recall Lucas-Kanade optical flow equation Gd = b where we invert G to solve for d • Feature can be tracked well if G – is above the image noise (eigenvalues of G are large) – well-conditioned (eigenvalues cannot differ by several orders of magnitude) Selecting “Good”Features λ τ λ τ λ λ λ ε λ λ > > ⇒ >> ⇒ < ⇒ ⎥ ⎥ ⎦ ⎤ ⎢ ⎢ ⎣ ⎡. mat) by this net. Let’s now quickly analyze the python code to do a perspective transformation. Warping may be used for correcting image distortion as well as for creative purposes (e. Right : The same image with the channels aligned. By estimating optical flow between video frames, you can measure the velocities of objects in the video. TensorLike, name: Optional[str] = None ) -> tf. Thus, it tries to minimize distortions in flow and prefers solutions which show more smoothness. Let’s say that optical flow is calculated each 8th x-coordinate and each 8th y-coordinate in a 64 x 64 image, for 10 timesteps. imread("sheet_paper. Patrick Schlosser, David Münch, Michael Arens. Then, the optical flow information is extracted from the image sequence in order to be used in the navigation algorithm. On the Middlebury optical flow evaluation website [3], [4], almost all top-ranked methods. The Case-II (green curve) represents the training with loss set to L m + 10 L f. [10]: Ik L = D kB W I H+ e (2) where D k is a down sampling matrix, B k blurring matrix, W k warping matrix and e k a noise vector. German Conference on Pattern Recognition, GCPR’18 (oral) pdf. – Repeat till convergence. , running a launch file that corresponds to the functionality. It then uses the warped features and fea-tures of the rst image to construct a cost volume, which is processed by a CNN to estimate the optical ow. de Abstract The FlowNet demonstrated that optical ﬂow estimation can be cast as a learning problem. Installation guide for Linux (Ubantu) users. In this article an implementation of the Lucas-Kanade optical flow algorithm is going to be described. Defines the Kernel Object and Interface. Sign up Implementation of warping with optical flow in tensorflow. Here we exploit recent advances in static semantic scene segmentation to segment the image into objects. 5) relates the velocity to the space-time image derivatives at one image location, and is often called the. SimpleITK is a C++ library that has bindings for Python. , morphing). Lucas and Takeo Kanade. Adaptive support -weight approach for correspondence search. The code can be downloaded from:. uni-saarland. The synthesized frame contains a mixture of the previous and next frames, each distorted by an amount determined by the optical ﬂow estimation. Use Python and OpenCV to draw shapes on images and videos. zeros_like(I0); Lets write class for making warps. We can also use optical flow for noise reduction. Detailed Description. The output of Optical Flow is a series of flow 2D vectors which in turn is called as the Flow Field. 29 Mar 2020 • lliuz/ARFlow • Unsupervised learning of optical flow, which leverages the supervision from view synthesis, has emerged as a promising alternative to supervised methods. Data are sequences of frame images. However, in real-life visual applications, such as tracking, activity detection and recognition, the time complexity is critical. This study adds warping operation to transform the image from rectangular to circular grid prior to the optical flow. detect the features cv::goodFeaturesToTrack(gray_prev,// the image features,// the output detected features max_co…. I am working on a tracking algorithm based on Lucas-Kanade Method using Optical Flow. Then we’ll move on to an entire section of the course devoted to the latest deep learning topics, including image recognition and custom image classifications. OK, I Understand. For Windows, you will need Python 3, TensorFlow, Pillow, SciPy, and MoviePy. [-1] current_frame_gray = current_frame. 3, num_warp=5, num_iter=10, tol=0. I'm trying to compute optical flow between two frames and then warp the previous frame using the computed optical flow. We present a compact but effective CNN model for optical flow, called PWC-Net. [28] propose a method that includes a spatio-temporal filtering using the Hermite transform and generalized motion models, such as the affine model, into a single spatial scale. combine an image rendered from optical ﬂows with an image generated by a conventional rendering technique through a simple Z-buffer algorithm. In today’s blog post, we learned how to compute image differences using OpenCV, Python, and scikit-image’s Structural Similarity Index (SSIM). We can also see that we can detect obstacles like this tree in front of us. Warp Area pop-up: Used to set the size of the area in the image that is ultimately affected by the warp grid. edu {hljin,zlin,scohen}@adobe. TV-L1 is a popular algorithm for optical flow estimation introduced by. convert image file and optical flow file into lmdb data - flow_lmdb. - Optical flow. A vision function may implement many similar or identical features from other functions, but it is still considered a single unique kernel as long as it is named by the same string. ) from the two input images. For Windows, you will need Python 3, TensorFlow, Pillow, SciPy, and MoviePy. I am writing codes in python for visual odometry from single camera. Adaptive guided image filter for warping in variational optical flow computation Article (PDF Available) in Signal Processing 127 · March 2016 with 200 Reads How we measure 'reads'. Optical Flow Algorithms. The input of the algorithm is an image sequence grabbed by an embedded camera on the B21r robot in motion. edu Abstract—In this paper we propose a novel approach to estimate. pdf), Text File (. A 3D-image capturing device implements distortion correction that has different correction precisions on images obtained according to an image capturing mode such as 3D video and 3D still images, and corrects optical axis shift by implementing on the image a stripping process that corresponds to an quantity of optical shift of left and right. It is 2D vector field where each vector is a displacement vector showing the movement of points from first frame to second. Unsupervised Stylish Image Description Generation via Domain Layer Norm Models Matter, So Does Training: An Empirical Study of CNNs for Optical Flow Estimation A Fusion Approach for Multi-Frame Optical Flow Estimation Localization-Aware Active Learning for Object Detection Context-aware Synthesis and Placement of Object Instances. Images are in the form of matrices for which rows and columns are integer values. Optical flow theory - introduction Optical flow means tracking specific features (points) in an image across multiple frames Human vision does optical flow analysis all the time – being aware of movement around them Use cases: Find objects from one frame in other frames Determine the speed and direction of movement of objects. gray_image # calc flow of movement optical_flow = cv2. I've successfully generated X and Y optical flow fields/maps using the Farneback method, but I don't know how to apply this to the input image coordinates to warp the images. The pair image-1 and image-2 are assumed to be temporally adjacent images taken a video sequence. Create an intermediate warping field (by interpolation) 2. I0 I1 OF results: You can see, that the algorithm cannot deal with too large displacements. Given a set of facial landmarks (the input coordinates) our goal is to warp and transform the image to an output coordinate space. Matas (Eds. Download handy Python IO routines. Abstract: This study estimates flow patterns of contrast agents from successive ultrasound image sequences by using an anisotropic diffusion-based optical flow algorithm. Optical flow estimation combining with objects edge features [42] HMFlow HMFlow: Hybrid Matching Optical Flow Network for Small and Fast-Moving Objects [43] PWC-Net Deqing Sun, Xiaodong Yang, Ming-Yu Liu, and Jan Kautz. flo warp target image according to the flow python warpImage. , morphing [1] ). Optical Flow Estimation Optical Flow Estimation Estimating the motion of every pixel in a sequence of images is a problem with many applications in computer vision, such as image segmentation, object classification,visual odometry, and driver assistance. Image warping is the process of digitally manipulating an image such that any shapes portrayed in the image have been significantly distorted. C++, Python and Java interfaces support Linux, MacOS, Windows, iOS, and Android. , morphing). ) and extract local invariant descriptors (SIFT, SURF, etc. Implementing Lucas-Kanade Optical Flow algorithm in Python In this article an implementation of the Lucas-Kanade optical flow algorithm The following figures and animations show the results of the algorithm on a few image sequences. Some of these input image sequences / videos are from the course and some are collected from the internet. SR optical flow uses optical flow to register consecutive frames and typically comprises the following five main steps 1. TypeError: If image is an invalid type. 4 with python 3 Tutorial 25 - YouTube. First we need to load the image we want to transform. Information and C++ code is in flow-code. The ground truth flow for each sequence has a suffix of _gt_flow_dist. optical-flow. Therefore, we need to design efficient algorithm to cope with the complexity. I am working on a tracking algorithm based on Lucas-Kanade Method using Optical Flow. uni-freiburg. Returns warped ndarray. The array would then be of size 10 x 8 x 8 x 2. Include a image similar to Fig. In today’s blog post, we learned how to compute image differences using OpenCV, Python, and scikit-image’s Structural Similarity Index (SSIM). 2s/frame, is signiﬁcantly more accurate than PCA-Flow, and achieves state-of-the-art performance in occluded regions on MPI-Sintel. You can access the full course here: Video and Optical Flow – Create a Smart Speed Camera Part 1 In this lesson, you will learn the basics of videos, and how function notation can be applied to find pixel intensities of videos. Lets see, what our algorithm produces for images that have more than 1-pixel shifts. Optical Flow is a technique for tracking flow of image objects in the scene. Citation Flett, Nicole Ku'ulei-lani. • Apply this flow to warp 1st frame toward 2nd frame. But when I see the warped frame. OPTICAL flow is a 2D image motion measure that has a wide range of applications in computer vision [14], video coding [16] and computer graphics [35]. Dilate Image Equalize Histogram Erode Image Gaussian Filter Histogram Image Pyramid Magnitude Mean and Standard Deviation Median Filter Min, Max Location Optical Flow Pyramid (LK) Phase Pixel-wise Multiplication Remap Scale Image TableLookup Thresholding Warp Affine. Furthermore, the cost function aims at generating smooth optical ﬂow ﬁelds. Convert the flow files into the color coding scheme to make them easier for humans to understand. I've successfully generated X and Y optical flow fields/maps using the Farneback method, but I don't know how to apply this to the input image coordinates to warp the images. Unsupervised Learning of Multi-Frame Optical Flow with Occlusions 3 we evaluate our approach on KITTI 2015 [21,22] and MPI Sintel [14]. But in step (5) we calculate multiplication of image gradient and this Jacobian - $\nabla I \frac{\partial W}{\partial p}$, and as far as I can see from the context (see, for example, Figure 2 on page 5), it is done for the whole image. ing of image sequences is the measurement of optical flow (or image velocity). Afterwards we’ll learn about direct video topics, such as optical flow and object detection. Index Terms—Optical flow, image motion, video motion, variational methods, optimization, features. Repeat until convergence. Conventional method: image upscaled with lanczos method (with OpenCV library) It is developed with python on chainer framework, flexible machine learning library. com Microsoft Research New England We live in a moving world • Perceiving, understanding and predicting motion is an important part of our daily lives Motion estimation: a core problem of computer vision •Related topics: – Image correspondence, image registration, image matching, image. edu Abstract Convolutional neural networks (CNNs) have recently been applied to the optical ﬂow estimation. In the flow based methods, an optical flow field is obtained for the entire image. Introduction Recent progress in optical ﬂow estimation has led to increased accuracy, driven in part by benchmarks. Occlusions in both views are detected and handled in the warping procedure. CS 482 9 warp the window in the second image by 3. can also be generated using the following Python code. Today, my imaginary readers, we improve our optical flow dramatically. The problem is: the flow is a velocity vector with decimal values. High Accuracy Optical Flow Estimation Based on a Theory for Warping ⋆ Thomas Brox, Andre´s Bruhn, Nils Papenberg, and Joachim Weickert Mathematical Image Analysis Group Faculty of Mathematics and Computer Science Saarland University, Building 27, 66041 Saarbru¨cken, Germany {brox,bruhn,papenberg,weickert}@mia. If there's anything that doesn't belong on the frame, it should be gone at next frame. distort_image_ops module: Python layer for distort_image_ops. - Rerun L-K on the new warped image to get a flow field from it to the second frame. a dense ﬂow ﬁeld using an image-aware MRF. obtain optical flow estimates at hgh frame rate, whch are then ac- cumulated and refined to obtain optical flow estimates at a standard frame rate. Mesh-based image warping For images or videos with parallax, mesh-based image warping is a popular approach. The TV-L1 solver is applied at each level of the image pyramid. Videos you watch may be added to the TV's watch history and influence TV recommendations. Pytorch implementation of FlowNet 2. David Münch. Image Morphing We know how to warp one image into the other, but how do we create a morphing sequence? 1. I have im1 and im2 (attached below) for which I compute the optical flow. •Next Level - Upsample the flow field to the next level as the first guess of the flow at that level. imread('DiscoveryMuseum_NoiseAdded. In this paper, we address the problem of how to select the optimal smoothness parameter λ of the variational optical flow algo-rithm itself. Transform input optical flow using a small CNN. You start filling every isolated valleys (local minima) with different colored water (labels). 3 minute read. Our second contribution. Optical Flow介绍与代码实现介绍首先我们先来介绍一下Optical Flow是个什么东西, 在浏览器的搜索框框里面我们输入"Optical flow"可以看到维基百科的解释: 光流(Optical flow or optic flow)是关于视域中的…. This study adds warping operation to transform the image from rectangular to circular grid prior to the optical flow. merge([r,g,b]) # switch it to rgb # Denoising dst = cv2. Optical Flow Constraints (gray scale images) Multi-Scale Flow Estimation image I t-1 image I t image I t+1 run Lucas-Kanade run Lucas-Kanade warp & upsample. a dense ﬂow ﬁeld using an image-aware MRF. In general: I and I0 have diﬀerent domain and range The function return diﬀerent values at the same location (if deﬁned) M. The Implementation of Optical Flow in Neural Networks. Any idea how this is possible? I'm using python 2. Abstract—Optical ﬂow estimation is classically marked by the requirement of dense sampling in time. To display optical flow vector field consistenly i use the following fucntion: function [ output ] = quiver_flow( u, v ) %QUIVER_FLOW Displays quiver for optical flow % SMatyunin2014. Extract dense optical flow and save as grayscale or RGB images - Readme. Large Displacement Optical Flow from Nearest Neighbor Fields Zhuoyuan Chen1 Hailin Jin2 Zhe Lin2 Scott Cohen2 Ying Wu1 1Northwestern University 2Adobe Research 2145 Sheridan Road, Evanston, IL 60208 345 Park Ave, San Jose, CA 95110 {zch318, yingwu}@eecs. - Apply this flow field to warp the first frame toward the second frame. This step is also known as warping. The method is tested on video sequences synthetically generated by perspective warping. Tensor Apply a non-linear warp to the image, where the warp is specified by a dense flow field of offset vectors that define the correspondences of pixel values in the output. The inputs will be sequences of images (subsequent frames from a video) and the algorithm will output an optical flow field (u, v) and trace the motion of the moving objects. • 3 points = affine warp! A triangulation of set of points in the plane is a partition of the convex hull to triangles whose vertices are the points, and do not contain other points. On the Integration of Optical Flow and Action Recognition. Python | Reading contents of PDF using OCR (Optical Character Recognition) Python is widely used for analyzing the data but the data need not be in the required format always. CiteSeerX - Document Details (Isaac Councill, Lee Giles, Pradeep Teregowda): We study an energy functional for computing optical flow that combines three assumptions: a brightness constancy assumption, a gradient constancy assumption, and a discontinuity-preserving spatio-temporal smoothness constraint. Image Registration - estimate the motion field between consecutive frames 3. Include a image similar to Fig. movement in the x, y, z-direction ) or rotation (yaw, pitch, roll). The Case-II (green curve) represents the training with loss set to L m + 10 L f. Cast in a learnable feature pyramid, PWC-Net uses the cur- rent optical flow estimate to warp the CNN features of the second image. , morphing). We use the input image to generate an initial optical ﬂow prediction. CS376 Computer Vision Lecture 6: Optical Flow Qixing Huang Feb. Transformed coordinates outside of the input image will be filled with zeros. The synthesized frame contains a mixture of the previous and next frames, each distorted by an amount determined by the optical ﬂow estimation. A picture is worth 1000 words when trying to explain a computer vision algorithm. Quiver for optical flow Standard matlab's quiver function has axis origin in left bottom corner, however, images have origin in top left corner. In kNN, we directly used pixel intensity as the feature vector. Follow 206 views (last 30 days) QEWE on 12 Dec 2011. Exploring Lukas Kanade Optical Flow Parameters. Our teacher model and student model have identical network structures. Defines the Kernel Object and Interface. Image Registration - estimate the motion field between consecutive frames 3. Optical Flow Estimation Optical Flow Estimation Estimating the motion of every pixel in a sequence of images is a problem with many applications in computer vision, such as image segmentation, object classification,visual odometry, and driver assistance. It then uses the warped features and features of the first image to construct a cost volume, which is processed by a CNN to estimate the optical flow. 3, num_warp=5, num_iter=10, tol=0. ; velx - Horizontal component of the optical flow of the same size as input images, 32-bit floating-point, single-channel; vely - Vertical component of the optical flow of the same size. Ç 1INTRODUCTION T HE variational framework [18], together with coarse-to-fine refinement [2], [23], is widely used in optical flow estimation [10], [12]. [4] presented FlowNet, the ﬁrst deep end-to-end network for optical ﬂow dense matching, later improved by Ilg et al. [7], the runway is modeled as a pla- nar surface and an initial model flow field is computed. Bachelor's thesis, Harvard College. It is simpler. I found cv2 has Farneback Optical FLow and so I'm using that to compute Flow. m and optical_flow_sand. Occlusions, Motion and Depth Boundaries 3 Occlusion Estimation. This process stops when we can obtain a good enough estimate of the shift which can almost warp to construct the second image from the first image using the estimated shift. In the case of optical flow, instead of a mathematical expression for mapping, we have motion vector for every pixel that tells us the location of each pixel in the next frame. For each timestep, for each x and for each y, I want to keep track of the vector containing the quantization code and its presence. Up-sampling 之後給下一層使用。 Data flow 如下。Image J (pyramid layer) 先 based on 上一層的 motion vector 做 warping 變. Motion field and parallax. The idea is to subtly warp each input image such that the image content lines up within regions of overlap. 5, 3, 15, 3, 5, 1. I would like to test warp the images by grid_sample, and I've got samples(two images with flow) from PWC-Net as follows: input images fr. You can have a look at all launch files provided here (be sure to choose the correct branch. Every optical flow estimation method is based on an assumption on the relationship between the searched motion field w: Ω → R 2 at time t and the image I (·, t). Warp one image toward the other using the estimated flow field Refine estimate by repeating the process I am not able to get the meaning of above steps, more specifically, step (2) and what "warping one image toward the other" means. Standard matlab's quiver function has axis origin in left bottom corner, however, images have origin in top left corner. The function inputs are two vx_pyramid objects, old and new, along with a vx_array of vx_keypoint_t structs to track from the old vx_pyramid. Computes the optical flow using the Lucas-Kanade method between two pyramid images. Lucas-Kanade •Works for small displacements. I've been playing with the optical flow functions in OpenCV and am stuck. Secondly, it shows a theoretically sound way of how image correspondence. TypeError: If image is an invalid type. Deqing Sun, et al. The function is an implementation of the algorithm described in [1]. This video is a presentation for the course EEE6512: Image Processing and Computer Vision , as a part of my final project submission. Introduction Recent progress in optical ﬂow estimation has led to increased accuracy, driven in part by benchmarks. Scikit-Image. Cross-dissolve the colors in the newly warped images Warp interpolation How do we create an intermediate warp at time t? For optical flow? • Easy. Fei-Fei Li Lecture 14 - From’images’to’videos’ • A’video’is’asequence’of’frames’captured’over’3me’ • Now’our’image’datais. Optical flow estimation combining with objects edge features [42] HMFlow HMFlow: Hybrid Matching Optical Flow Network for Small and Fast-Moving Objects [43] PWC-Net Deqing Sun, Xiaodong Yang, Ming-Yu Liu, and Jan Kautz. transform_ops module: Image transform ops. In this article an implementation of the Lucas-Kanade optical flow algorithm is going to be described. Use feature detection techniques to focus on interesting parts of an image Work with several features in a single image, using the NumPy and SciPy Python libraries Learn about optical flow to identify objects that change between two image frames Use SimpleCV’s command line and code editor to run examples and test techniques Table of Contents. [4] presented FlowNet, the ﬁrst deep end-to-end network for optical ﬂow dense matching, later improved by Ilg et al. PyImageSearch is the go to place for computer vision. You're signed out. Dense optical flow like the Lucas-Kanade method is not appropriate for mobile devices due to its slow execution time. I'm trying to compute optical flow between two frames and then warp the previous frame using the computed optical flow. 2016 indigo branch is used for ROS Indigo, Jade, and Kinetic distros). This study adds warping operation to transform the image from rectangular to circular grid prior to the optical flow. David Münch. The step guides are all working out of the box. Apply a non-linear warp to the image, where the warp is specified by the source and destination locations of a (potentially small) number of control points. It then uses the warped features and features. hk Yasuyuki Matsushita Microsoft Research Asia [email protected] The test image I used, the program and the result can be found in the below image. 3024, 25-36, May 2004. It is 2D vector field where each vector is a displacement vector showing the movement of points from first frame to second. It can process images and videos to identify objects, faces, or even the handwriting of a human. uni-freiburg. AU - Achmad, Balza. Optical Flow-based Warping? - posted in Fusion: Hi, Does anyone know if there exists plugins for DF or even standalone software that lets you warp an image using the optical flow of another sequence. I wish to use this to warp image C to D. Anke Meyer-Baese, Joan Massich, Guillaume Lemaitre, Mojdeh Rastgoo. compose_ops module: Compose Ops. This is often done by computing the ow as the minimizer of an. Estimation principles. , morphing [1] ). Recommended for you. Their method uses a coarse-to-fine warping strategy to measure larger optical flow vectors. Getting these motion vectors, and the image, we can move every pixel and generate a new one. Their optical flow method combines three assumptions: a brightness constancy assumption, a gradient constancy assumption and a spatio-temporal smoothness constraint. It is simpler. { Balanced Optical Flow: There is a desire to minimize the inconsistency in the velocity eld when going from image 1 to image 2 and from image 2 to image 1. For example, tasks such as: load data from disk, decode, crop, random resize, color and spatial augmentations and format conversions, are mainly carried out on the CPUs. CS 482 9 warp the window in the second image by 3. I have computed the optical flow between images A and B. Secrets of Optical Flow Estimation and Their Principles. The TV-L1 solver is applied at each level of the image pyramid. To attenuate pixelation, we use the common defocusing ap-. Optical flow is a vector field of apparent motion of pixels between frames. So what is image stitching ? In simple terms, for an input there should be a group of images, the output is a composite image such that it is a culmination of image scenes. Our evaluation demonstrates that the novel method gives significantly smaller angular errors than previous techniques for optical flow estimation. VideoCapture(0) imageCapture. One of the fundamental problems in computer vision is to attain the apparent motion in image sequences, the optical flow. SR optical flow uses optical flow to register consecutive frames and typically comprises the following five main steps 1. ing of image sequences is the measurement of optical flow (or image velocity). import cv2 import numpy as np img = cv2. 0: Evolution of Optical Flow Estimation with Deep Networks. 𝑓𝑓 (𝑥𝑥) 5. So let's import the libraries and then we load the image. Sevilla, Y. This project has the following scripts: Optical_flow_estimation, myFlow, myWarp, computeColor, flowToColor. David Münch. This step is also known as warping. It can be understood as a per-pixel displacement field. I've been playing with the optical flow functions in OpenCV and am stuck. match_keypoints. In general, moving objects that are closer to the camera will display more apparent motion than distant objects that are moving at the same speed. I wish to use this to warp image C to D. The Lucas-Kanade optical flow The Lucas-Kanade ( LK ) algorithm was originally proposed in 1981, and it has become one of the most successful methods available in Computer Vision. Citation Flett, Nicole Ku'ulei-lani. pdf), Text File (. As you can see the program is pretty simple and we did not even use any OpenCV packages. visualize flow in rgb code python flowToColor. As OF usually deals only with small displacements, we need iterative estimation: estimate, shift image by found vectors, find again. 4 questions Tagged. We then learn about optical flow which is the pattern of apparent motion of image objects between two consecutive. optical_flow_sand. Lets see, what our algorithm produces for images that have more than 1-pixel shifts. Abstract—Optical ﬂow estimation is classically marked by the requirement of dense sampling in time. Dilate Image Equalize Histogram Erode Image Gaussian Filter Histogram Image Pyramid Magnitude Mean and Standard Deviation Median Filter Min, Max Location Optical Flow Pyramid (LK) Phase Pixel-wise Multiplication Remap Scale Image TableLookup Thresholding Warp Affine. Our evaluation demonstrates that the novel method gives significantly smaller angular errors than previous techniques for optical flow estimation. imread("sheet_paper. The goal of this project is the estimation of a dense optical flow field, that is, for every pixel in the image a 2D motion vector is estimated for every frame. - Repeat till convergence. Regarding image warping, a survey of various warping methods can be found in [Wol90]. I took the default parameters from the cv2 tutorial and I'm warping the frame using the code given in this answer. 3, num_warp=5, num_iter=10, tol=0. So in short, above equation says that the depth of a point in a scene is inversely proportional to the difference in distance of corresponding image points and their camera centers. Efficient Graph-Based Image Segmentation in Python. JPEG") We then need to select 4 points, in order: top-left, top-right, bottom-left, bottom. It then uses the warped features and features. 5 / factor pyr = [] tmp = I pyr. C++, Python and Java interfaces support Linux, MacOS, Windows, iOS, and Android. I used cell phone camera for testing. Detailed Description. 0: Evolution of Optical Flow Estimation with Deep Networks Eddy Ilg, Nikolaus Mayer, Tonmoy Saikia, Margret Keuper, Alexey Dosovitskiy, Thomas Brox University of Freiburg, Germany {ilg,mayern,saikiat,keuper,dosovits,brox}@cs. 4Visualization mmcvcan show images and annotations (currently supported types include bounding boxes). Warped Optical-Flow Inter-Frame Reconstruction for Ultrasound Image Enhancement Article (PDF Available) in Journal of Computer Science 7(10):1532-1540 · January 2011 with 118 Reads. Use inverse warping in the second image to take an image close to the first one, i. uni-saarland. Secrets uncovered • Pre-processing: Some kind of image filtering is useful but simple gradient. Warp one image toward the other using the estimated flow field Refine estimate by repeating the process I am not able to get the meaning of above steps, more specifically, step (2) and what "warping one image toward the other" means. There was a problem loading your content. The same commands can be used for training or inference with other datasets. [28] propose a method that includes a spatio-temporal filtering using the Hermite transform and generalized motion models, such as the affine model, into a single spatial scale. Open and Stream video with Python and OpenCV. Demonstration of image registration using optical flow. Extract dense optical flow and save as grayscale or RGB images - Readme. shape[:2] moments = cv2. 0001, prefilter=False, dtype=) [source] ¶ Coarse to fine optical flow estimator. , the problem on the finer resolution level is compensated by the already computed optical flow field. This has two important effects: Firstly, it becomes possible to integrate the warping technique, which was so far only algorithmically motivated, into a variational framework. This method assumes that optical flow is a necessary constant in a local neighborhood of the pixel that is under consideration and solves the basic Optical. OK, I Understand. com Abstract We discuss the cause of a severe optical ﬂow estima-tion problem that ﬁne motion structures cannot always be. Select the top 'm' matches for each descriptor of an image. Optical flow approximates the motion field in an image from the patterns in the intensity of. 1 Models Matter, So Does Training: An Empirical Study of CNNs for Optical Flow Estimation Deqing Sun, Xiaodong Yang, Ming-Yu Liu, and Jan Kautz Abstract—We investigate two crucial and closely related aspects of CNNs for optical ﬂow estimation: models and training. Real-time Projector Depixelation for Videos Abstract The screen-door eﬁect or projector pixelation is a visual artifact produced by many digital projectors. I computed the flow with: flow = cv2. Optical flow estimation combining with objects edge features [42] HMFlow HMFlow: Hybrid Matching Optical Flow Network for Small and Fast-Moving Objects [43] PWC-Net Deqing Sun, Xiaodong Yang, Ming-Yu Liu, and Jan Kautz. Optical Flow with Theoretically Justified Warping Applied to Medical Imaging. Such tools are not ideal when you want to understand and tweak the processes and/or to use clusters. I used code to read first image height=4000 fx. This project has the following scripts: Optical_flow_estimation, myFlow, myWarp, computeColor, flowToColor. The Case-I (red curve) represents the train-ing with L m only. Optical flow • Recover image motion at each pixel from spatio-temporal image brightness variations (optical flow) Feature-tracking • Extract visual features (corners, textured areas) and “track” them over multiple frames • Shi-Tomasi feature tracker • Tracking with dynamics • Implemented in Open CV. Time for action – warping frames using optical flow Now that you have seen both the methods, it is time to try and reconstruct the first frame of the pair, using the second one and the optical flow field. Optical Flow generally produces smoother animations than a velocity remap ﬁlter. Optical flow describes apparent motion of objects in image sequence. Since ﬁnding the assignment of minimum costs is NP-complete, an eﬃcient greedy algorithm searches a local. A simple comparison showing several examples of dense optical flow methods from the recent GPU module of the OpenCV Library. I tried asking in the forum, but it seems pretty much inactive. Then we’ll move on to an entire section of the course devoted to the latest deep learning topics, including image recognition and custom image classifications. Include a image similar to Fig. calcOpticalFlowFarneback(im1g, im2g, None, 0. Optical Flow synthesizes frames needed to complete the effect instead of blending adjacent frames as most retiming applications do. Occlusion Aware Unsupervised Learning of Optical Flow. •P(t) is a moving 3D point •Velocity of scene point: V = dP/dt. We are gonna look at two ways to get the interpolated image: forward mapping (warping) and backward mapping (warping). In such cases, we convert that format (like PDF or JPG etc. PWC-Net has been designed according to simple and well-established principles: pyramidal processing, warping, and the use of a cost volume. Optical Flow Estimation David J. 0, the reason for Flownet 2. At the same time, the logical flow between the images must be preserved. Whether the image is a 3-D array in which the third axis is to be interpreted as multiple channels. I'm trying to compute optical flow between two frames and then warp the previous frame using the computed optical flow. In the output flow Mat, included vector point from self current point. I tried asking in the forum, but it seems pretty much inactive. To overcome this problem, this study focused on the time-series movement of plant leaves, using optical flow (OF) analysis to acquire this information for a lettuce. PWC-Net: CNNs for Optical Flow Using Pyramid, Warping, and Cost Volume. edu {hljin,zlin,scohen}@adobe. Adaptive guided image filter for warping in variational optical flow computation Article (PDF Available) in Signal Processing 127 · March 2016 with 200 Reads How we measure 'reads'. Installation guide for Linux (Ubantu) users. The trick to address this issue is to iterate the process of solving for u and v through alternating steps of solving and warping. 2, 0) I understood that the function warp_flow expects the original images with values in [0,255] and the computed flow computed on grayscale as input, so I called it with: prediction = warp_flow(origim1, flow) However, when I write the truth. FlowJ is a plugin that implements the main gradient-based optical flow techniques, such as Lucas and Kanade, Uras, Fleet and Jepson and Singh algorithms. This project has the following scripts: Optical_flow_estimation, myFlow, myWarp, computeColor, flowToColor. The scheme includes a final interpolation step in order to produce a smooth field of motion vectors. This step is also known as warping. float32([[1, skew, -0. Image recognition is, at its heart, image classification so we will use these terms interchangeably throughout this course. py --fname_image examples/grove2_frame10. Press J to jump to the feed. Motion Detail Preserving Optical Flow Estimation∗ Li Xu Jiaya Jia The Chinese Universityof Hong Kong {xuli,leojia}@cse. A simple comparison showing several examples of dense optical flow methods from the recent GPU module of the OpenCV Library. Now, considering that our camera is moving within a scene, some patterns of optical ﬂow will be generated on the spherical image. Assume that a point (u, v) on frame 1 move to (u', v') on frame 2, then the displacement vector (u' - u, v' - v) is one of the optical flows between the frames. In this paper, we suggest a variational model for optic flow computation based on non-linearised and higher order constancy assumptions. Such data pipelines involve compute-intensive operations that are carried out on the CPU. All code is compatible with Python 3. The array would then be of size 10 x 8 x 8 x 2. [-1] current_frame_gray = current_frame. Optic flow is the apparent motion of objects or surfaces. Existing optical flow methods make generic, spatially homogeneous, assumptions about the spatial structure of the flow. It is 2D vector field where each vector is a displacement vector showing the movement of points from first frame to second. dense optical flow is little bit different with feature tracking optical flow. CiteSeerX - Document Details (Isaac Councill, Lee Giles, Pradeep Teregowda): We study an energy functional for computing optical flow that combines three assumptions: a brightness constancy assumption, a gradient constancy assumption, and a discontinuity-preserving spatio-temporal smoothness constraint. The deep learning revolution in optical ﬂow started with deep descriptors [29,6,2] and densiﬁcation meth-ods [34]. Bachelor's thesis, Harvard College. Afterwards we’ll learn about direct video topics, such as optical flow and object detection. 1 (stable) r2. Abstract—Optical ﬂow estimation is classically marked by the requirement of dense sampling in time. OpenCV is a huge open-source library for computer vision, machine learning, and image processing. , morphing). Sevilla, Y. Such tools are not ideal when you want to understand and tweak the processes and/or to use clusters. The image warping technique, which was used in our study, is used to properly align the images of the same scene. VisionWorks™ implements and extends the Khronos OpenVX standard, and it is optimized for CUDA-capable GPUs and SOCs enabling developers to realize CV applications on a scalable and flexible platform. A three-fold speedup is observed on standard image alignment tasks. , a gray-valued image), and its computation involves a warping of I1 and ∇I1 by the deformation u0. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. An iterative image registration technique with an application to stereo vision. Apply a non-linear warp to the image, where the warp is specified by the source and destination locations of a (potentially small) number of control points. Optical flow is the pattern of apparent motion of image objects between two consecutive frames caused by the movemement of object or camera. We present a compact but effective CNN model for optical flow, called PWC-Net. is the distance between two cameras (which we know) and is the focal length of camera (already known). Jain, Fundamentals of Digital Image Processing. from MIT in this paper. "PWC-Net: CNNs for Optical Flow Using Pyramid, Warping, and Cost. They are from open source Python projects. Their method uses a coarse-to-fine warping strategy to measure larger optical flow vectors. Face alignment with OpenCV and Python. You can uncomment. These patterns were discussed in great. The code below shows how to take four corresponding points in two images and warp image onto the other. Of course, we do not expect the brightness to be constant across the images in scene alignment. Image warping produces a new image I0 such that: I0(T θ(x)) = I(x) for each x ∈ D. warping × 183 Inverse Flow - Forward Warping or Bilinear "Splatting" warping. to optical ﬂow estimation. In this paper, we present a real-time projector depixela-tion framework for displaying high resolution videos. com Abstract. However, Jacobian of the warp is (not surprisingly) defined only for a single pixel and not the entire image. 5 / factor pyr = [] tmp = I pyr. Tensor Apply a non-linear warp to the image, where the warp is specified by a dense flow field of offset vectors that define the correspondences of pixel values in the output. shape[:2] moments = cv2. [13] proposed a hybrid warping model that fuses two stitching ﬁelds to generate natural-looking panoramas. Image warping example Image warping is the process of digitally manipulating an image such that any shapes portrayed in the image have been significantly distorted. #N#We have already seen an example of color-based tracking. However, for real image sequences, the temporal continuity assumption is often violated due to outliers and occlusions, causing inaccurate flow vectors at these regions. By estimating optical flow between video frames, you can measure the velocities of objects in the video. Some of these input image sequences / videos are from the course and some are collected from the internet. High Accuracy Optical Flow Estimation Based on a Theory for Warping by Thomas Brox, Andrés Bruhn, Nils Papenberg, Joachim Weickert , 2004 We study an energy functional for computing optical flow that combines three assumptions: a brightness constancy assumption, a gradient constancy assumption, and a discontinuity-preserving spatio-temporal. dense_image_warp ) has an assumption on the format of flow map which is not consistent with primary. py --fname_image examples/grove2_frame10. Dense optical flow like the Lucas-Kanade method is not appropriate for mobile devices due to its slow execution time. Optical flow •Definition: optical flow is the apparent motion of brightness patterns in the image •Ideally, optical flow would be the same as the motion field •Have to be careful: apparent motion can be caused by lighting changes without any actual motion •Think of a uniform rotating sphere under fixed. After each warping operation, errors are generated at the corresponding regions of the warped interpolation image. imread("sheet_paper. This is because each optical flow file occupies about 15. Installation guide for Linux (Ubantu) users. SimpleITK is a C++ library that has bindings for Python. / pyrfactor) **. Hallucinating Dense Optical Flow from Sparse Lidar for Autonomous Vehicles Victor Vaquero, Alberto Sanfeliu and Francesc Moreno-Noguer Institut de Robotica i Inform atica Industrial, CSIC-UPC Llorens i Artigas 4-6, 08028 Barcelona, Spain fvvaquero,sanfeliu,[email protected] The idea is to subtly warp each input image such that the image content lines up within regions of overlap. Deep learning applications require complex, multi-stage pre-processing data pipelines. Unsupervised Stylish Image Description Generation via Domain Layer Norm Models Matter, So Does Training: An Empirical Study of CNNs for Optical Flow Estimation A Fusion Approach for Multi-Frame Optical Flow Estimation Localization-Aware Active Learning for Object Detection Context-aware Synthesis and Placement of Object Instances. • 3 points = affine warp! A triangulation of set of points in the plane is a partition of the convex hull to triangles whose vertices are the points, and do not contain other points. Optical flow theory - introduction Optical flow means tracking specific features (points) in an image across multiple frames Human vision does optical flow analysis all the time – being aware of movement around them Use cases: Find objects from one frame in other frames Determine the speed and direction of movement of objects. flo') warpped_img2=mmcv. t elements of H - Two steps: grid generator & differentiable sampling - Grid generator: Is a pixel in the image I’ - Applying inverse of H to G. The result-ing PCA-Layers method runs in 3. input image I(x), where x = (x,y)T is a column vector containing the pixel coordinates. Ç 1INTRODUCTION T HE variational framework [18], together with coarse-to-fine refinement [2], [23], is widely used in optical flow estimation [10], [12]. The TV-L1 solver is applied at each level of the image pyramid. flo warp target image according to the flow python warpImage. Hi All, I'm on a gesture recognition project that can be found here www. This problem appeared as an assignment in this computer vision course from UCSD. Using image warping by the estimated flow, we devise a simple yet effective unsupervised method for learning optical flow, by directly minimizing photometric consistency. 5 / factor pyr = [] tmp = I pyr. About Optical Flow ~ Optical flow is the 2D velocity field , describing the apparent motion in the image that results from independently moving objects in the scene or from observer motion. SR optical flow uses optical flow to register consecutive frames and typically comprises the following five main steps 1. The function is an implementation of the algorithm described in [1]. I am writing codes in python for visual odometry from single camera. The fundamental assumption enabling optical flow estimation is brightness conservation:. Assumption of constant flow (pure translation) for all pixels in a larger window is unreasonable for long periods of time. We aim to explore broad possibilities, that offered by deep learning to further improve the performance of our PIV solver, as we believe that the sky is the limit. Repeat until convergence. Include a image similar to Fig. 0 API r1 r1. OpenCV Python Homography Example. 03 px ; Mean y = 2. Adaptive guided image filter for warping in variational optical flow computation. • Apply this flow field to warp 1st frame toward 2nd frame. We present a compact but effective CNN model for optical flow, called PWC-Net. Image +1 S Warped Image +2 S Warped Image + 1 S Warped Image + 2 S Image Warp Image Warp Photometric Loss Photometric Loss Loss for Occluded Pixels Forward Flow wB Backward Flow w> Backward Occlusion 1 Forward Occlusion 1B Figure 2: Framework overview of DDFlow. In this article an implementation of the Lucas-Kanade optical flow algorithm is going to be described. Since the model strictly refrains from a linearisation of these assumptions, it is also capable to deal with. In essence, Optical Flow manufactures entire frames. The optical ow problem is ill-posed and to favor small velocity eld, Tikhonov regularization is achieved by penalizing the norm of the velocity eld. Cast in a learnable feature pyramid, PWC-Net uses the current optical flow estimate to warp the CNN features of the second image. It uses image feature points to track an object. • Rerun L-K on new warped image to get flow field from it to 2nd frame. (image-optical-flow image-1 image-2 warp-Y warp-X) image-optical-flow computes the pixelwise 2D field which describes the warp from one image to an other. 5 * w * skew], [0, 1, 0]]) image = cv2. However, we can easily generalize Lucas-Kanade approach to other 2D parametric motion models (like affine or projective) by introducing a "warp" function W. It enables users to achieve smooth speed and framerate changes by interpolating missing frames. Every optical flow estimation method is based on an assumption on the relationship between the searched motion field w: Ω → R 2 at time t and the image I (·, t). Introduction, usage. Given that the range of motion expressible by a human face is limited, and that. import cv2 import numpy as np img = cv2. Pajdla and J. A common heuristic prediction approach is to track the motion of precipitation features from a sequence of weather radar images and then to displace the precipitation field to the imminent future (minutes to hours) based on that motion. % optical flow or visualization method %%% % optical flow methods are referenced by function handles. A numerical scheme based on fixed point iterations is used. At the same time, the logical flow between the images must be preserved. 2, 0) I want to apply this flow to prev image to somehow create next image. In this paper, we present a real-time projector depixela-tion framework for displaying high resolution videos. I have installed version 6. – Rerun L-K on the new warped image to get a flow field from it to the second frame. They are from open source Python projects. Due to the inpainting of the optical ﬂow, the raw warp ﬁeld may contain artifacts at the valid/invalid region boundaries. moments(image) # De-skew the image by applying an affine transformation skew = moments["mu11"] / moments["mu02"] matrix = np. 0, the reason for Flownet 2. The above program is given below. High Accuracy Optical Flow Estimation Based on a Theory for Warping by Thomas Brox, Andrés Bruhn, Nils Papenberg, Joachim Weickert , 2004 We study an energy functional for computing optical flow that combines three assumptions: a brightness constancy assumption, a gradient constancy assumption, and a discontinuity-preserving spatio-temporal. But with velocity vectors, with optical flow vectors. P´erez-Ru. Optical flow estimation using the steered Hermite transform There have been previous approaches to motion estimation based on the Hermite transform. Lets apply multiscale scheme now. By definition, the optical flow is the vector field (u, v) verifying image1(x+u, y+v) = image0(x, y), where (image0, image1) is a couple of consecutive 2D frames from a sequence. Optical Flow Calculation Techniques Here I will discuss a variety of techniques that can be used to calculated optical flow given two sequential images. Color image is an addi-tional natural resource of information that can facilitate the problem resolution. Part 3 Even with multiple warps. Semi-Supervised Learning for Optical Flow with Generative Adversarial Networks Wei-Sheng Lai 1Jia-Bin Huang2 Ming-Hsuan Yang;3 1University of California, Merced 2Virginia Tech 3Nvidia Research 1{wlai24|mhyang}@ucmerced. Sparse optical flow gives the flow vectors of some "interesting features" (say few pixels depicting the edges or corners of an object) within the frame while Dense optical flow, which gives the flow vectors of the entire frame (all pixels) - up to one flow vector per pixel. zeros_like(I0); Lets write class for making warps. Therefore, we need to design efficient algorithm to cope with the complexity. gray_image # calc flow of movement optical_flow = cv2. I'm using the optical flow to get the motion information, the problem is that I'm a bit lost on how to threat with the motion data. With u and v are the displacements of the pixel at $(x,y)$, the 1st assumption gives rise to. Adaptive support -weight approach for correspondence search. Python OpenCV: Optical Flow with Lucas-Kanade method. A Kernel in OpenVX is the abstract representation of an computer vision function, such as a “Sobel Gradient” or “Lucas Kanade Feature Tracking”. Black, Optical flow estimation using a spatial pyramid network. Python | Reading contents of PDF using OCR (Optical Character Recognition) Python is widely used for analyzing the data but the data need not be in the required format always. Farneback dense optical flow(cpu version). There are an exponential number of triangulations of a point set. – Rerun L-K on the new warped image to get a flow field from it to the second frame. Once these parameters are known, warping one image so that it aligns with the other is straight forward. They are from open source Python projects. Horn-Schunck [6] – This is a classic approach to calculate the optical flow between two images. calcOpticalFlowFarneback(). We will try to accomplish that by a straightforward method called interpolation. Individual feature points are tracked across … - Selection from Artificial Intelligence with Python [Book]. * Overview The Optical Flow ﬁlter estimates the motion between two frames of video and renders an intermediate frame that interpolates the motion. Fleet, Yair Weiss ABSTRACT This chapter provides a tutorial introduction to gradient-based optical ﬂow estimation. Motion Field and Optical Flow Field • Motion field: projection of 3D motion vectors on image plane • Optical flow field: apparent motion of brightness patterns • We equate motion field with optical flow field 0 0 0 0 1 0 0 0 0 ˆ related to by Object point has velocity ,induces in image r z r r r r r v r v v v ⋅ = = = f dt d dt d P i i i i. m and optical_flow_sand. Lets apply multiscale scheme now. But when I see the warped frame. Optical Flow Algorithms. Search Search. The problem is: the flow is a velocity vector with decimal values. By definition, the optical flow is the vector field (u, v) verifying image1(x+u, y+v) = image0(x, y), where (image0, image1) is a couple of consecutive 2D frames from a sequence. The code below shows how to take four corresponding points in two images and warp image onto the other. Image stitching with OpenCV and Python. Luckily for us, we can now easily compute the differences and visualize the results with this handy script made with Python, OpenCV, and scikit-image. Learning by Analogy: Reliable Supervision from Transformations for Unsupervised Optical Flow Estimation. com and now I'm working on the motion detection part. This step is also known as warping.


text: Images, images, and more images. (Delivery or UPS charges will apply)(Non local sales can be arranged. When determining the best Lewis structure (or predominant resonance structure) for a molecule, the structure is chosen such that the formal charge on each of the atoms is as close to â¦ First draw the Lewis structure for the polyatomic ion. If we did, we'd find that the formal charge for each atom in H2CO3 is 0, making this the Lewis structure for H2CO3. Formal charge (FC) is the electric charge of an atom in a molecule. The formal charge on each of the atoms can be calculated as follows. F is a group 17 element which are referred to as halogens. Thus, the formal charge on C is 4 - 5 = - 1. Post by Chem_Mod » Thu Sep 15, 2011 8:29 am When you draw out the Lewis structure of CO3^2-, one resonance has C=O double bond and 2 C-O^-1 single bonds, these two O^-1 are capable of binding to a metal center at 2 different places, therefore CO3^2- is classified as a bidentate ligand. If we do, we will get: 1-1 = 0. The sum of the formal charges in a polyatomic ion will add up to the charge on the ion. Now, to determine the formal charge of H, we will simply subtract 1 from the valence electron of H predicted by the periodic table. SO3^2- has a total of 26 electrons, including three lone pairs on each singly bonded oxygen, two lone pairs on the doubly bonded oxygen and a â¦ In the carbonate ion, the carbon atom is bonded with a double bond to an oxygen atom, and with single bonds to two oxygen atoms. Xe is a group 18 element which are referred to as noble gas which has octet electron configuration but due to the two F - Xe has + 2 formal charges. Formal Charge Key Takeaways . See the answer. They can be drawn as lines (bonds) or dots (electrons).One line corresponds to two electrons.The nonbonding electrons, on the other hand, are the unshared electrons and these are shown as dots. CO3 (carbonate ion) has an overall charge of -2. Therefore F has - 1 charge. Thus the formal charges on the atoms in the Lewis structure of CN-are: Therefore, the formal charge of H is zero. Non-bonding Electrons Bonds Formal Charge N 5 2 3 0 C 4 0 4 0 O 6 6 1 -1 Total Formal Charge -1 Structure 4(a) has a formal charge of -1 on N, when oxygen is the most electronegative atom. The carbonate ion [C O 3 2 â] has an overall charge of -2. Contoh #3: CO 3 2â Total elektron valensi = 1 × elektron valensi C + 3 × elektron valensi O = (1 × 4) + (3 × 6) + 2 e muatan = 24 elektron. Ask questions, doubts, problems and we will help you. The formal charge of an atom in a molecule is the hypothetical charge the atom would have if we could redistribute the electrons in the bonds evenly between the atoms. Formal charge (FC) is given by the formula. Formal charge is used to estimate the way electric charge is distributed in a molecule. Every element in the compound has its own formal charge. It is calculated as the number of valence electrons minus half the number of electrons shared in a bond minus the number of electrons not bound in the molecule. FC=V-N-B/2. 0-1 2 1-1 (CORRECT) Identify the strongest bond. Gear only sold Locally. Formal charge is the charge assigned to an atom in a molecule, assuming that electrons in all chemical bonds are shared equally between atoms, regardless of relative electro negativity. These molecules are visualized, downloaded, and analyzed by users who range from students to specialized scientists. Users can perform simple and advanced searches based on annotations relating to sequence, structure and function. The formal charge of an atom in a molecule is the hypothetical charge the atom would have if we could redistribute the electrons in the bonds evenly between the atoms. Similarly, formal charge of C will be: 4 â 4 = 0. Formal Charge of Atoms: A formal charge is useful when describing the distribution of electrons around an atom. Because the number of valence electrons on a neutral N atom is 5, its formal charge is 5 - 5 = 0. Using Formal Charge to Predict Molecular Structure. In the carbonate ion, the carbon atom is bonded with a double bond to an oxygen atom, and with single bonds to two oxygen atoms. Hot To GelCo3 Charge. ** B) I is favored by the octet rule and II by formal charge considerations. Answer in Organic Chemistry Question for Morgan Q&A 129345. The lewis structure is shown below a) Formal charge = [# of valence electrons] [electrons in lone pairs + 1/2 the number view the full answer. The formal charge on three oxygen atom has electron pair shared by chlorine, C l = 2 S â L v â 1 = 0 = 2 × 2 â 6 6 â 1 = â 1 The formal charge on the oxygen atom having an electron pair shared by chlorine and hydrogen, then the formal charge is : And formal charge of N will be: 5-5 = 0 (recall to count the lone pairs on N) The formal charge of H is 0 and the formal charge of F is 0 Because the formal charges of the individual atoms add to zero, the hydrogen fluoride molecule is neutral overall. CO3 : Summary. Formal charge on an atom in a lewis structure = total number of valence electrons in free atom - (total number of non-bonding electrons) - 1/2 (total number of bonding electrons) Now formal charge on carbon = 4 - 0 - 1/2 (8) = 0 We could check our formal charges. ... * The CO3^2- ion contains two â¦ What is the formal charge on the C? The formal charge of an atom can be determined by the following formula: $FC = V - (N + \frac{B}{2})$ In this formula, V represents the number of valence electrons of the atom in isolation, N is the number of non-bonding valence electrons, and B is the total number of electrons in covalent bonds with other atoms in the molecule. Calculating Formal Charge. So the formal charges do make sense here because the black Oxygens here and here both have a formal charge of negative 1 and the Carbon and the other Oxygen are 0. Re: CO3 2- can be mono or bidentate? Lewis structures also show how atoms in the molecule are bonded. double covalent bond -----FALSE triple covalent bond <---- PROBABLY CORRECT single covalent bond all of the above bonds are the same strength. The arrangement of atoms in a molecule or ion is called its molecular structure.In many cases, following the steps for writing Lewis structures may lead to more than one possible molecular structureâdifferent multiple bond and lone-pair electron placements or different arrangements of atoms, for instance. The formal charge is found by subtracting the number of lone electrons and half the number of bonded electrons from the total number of valence electrons. Mono or bidentate Resonance structures that Fit the octet rule and II by formal charge = valence electrons Nonbonding! Well as single bonds to double oxygen atoms formal C dan O masing-masing 0 namun jumlah elektron dimiliki! Is plus 1 sesuai aturan oktet Group No be copiously flushed with water channeled... Co 3 2- ] has an overall charge of minus 1 when combining the charges of wwPDB. 5 = 0 the wwPDB, the formal charge = valence electrons and each of the compound you. Tidak sesuai aturan oktet: 4 â 4 = 0 bond to oxygen atoms have valence... And II by formal charge on C is 4 - 5 = 1. Co3 ( carbonate ion is drawn below, but incomplete ( CORRECT ) Identify the bond. -1 4 ( C ) atom Group No a Lewis structure for the carbonate ion ) has an overall of. Masing-Masing 0 namun jumlah elektron yang dimiliki C tidak sesuai aturan oktet is Group. Outer shell formal C dan O masing-masing 0 namun jumlah elektron yang dimiliki C tidak sesuai aturan.. Upon standards its on the atoms can be copiously flushed with water and channeled to a system. Namun jumlah elektron yang dimiliki C tidak sesuai aturan oktet material can be calculated as follows be arranged is nitrogen... Will get: 1-1 = 0 the ion oxygen is more electronegative then nitrogen, RCSB. No3 is plus 1 element which are referred to as halogens is plus 1 charges will ). With water and channeled to a treatment system or holding tank co3 formal charge reclamation proper. Adding in formal charges and Non-bonding electrons ion carries a total charge of H zero... Holding tank for reclamation or proper disposal find that the negative charge is on nitrogen that, this Dr.! Visualized, downloaded, and co3 formal charge for watching one nitrogen atom and three oxygen atoms as as... 5 - 5 = 0 up to the charge on each of the formal charges and Non-bonding electrons do we. And Non-bonding electrons plus 1, this is Dr. B., and for... Will apply ) ( Non local sales can be arranged ) ( Non local can. Formal C dan O masing-masing 0 namun jumlah elektron yang dimiliki C tidak sesuai aturan oktet that does up. Structure by Adding in formal charges on the atoms in the molecule are bonded calculated as follows by Adding formal. Neutral N atom is 4 referred to as halogens flushed with water and channeled to a treatment or... ( Delivery or UPS charges will apply ) ( Non local sales can be arranged ion will add to. On nitrogen single bonds to double co3 formal charge atoms the negative charge is distributed in polyatomic! These molecules are visualized, downloaded, and analyzed by users who range students. The ion with what we have for the carbonate ion [ CO 3 2- ] has an charge. Same exercise for structure # 2 and you find that the negative charge is 5 - 5 =.. Atom is 5 - 5 = - 1 therefore, the formal charge -1 4 ( C ) Group! First Draw the Lewis structure for the polyatomic ion will add up to charge. Valence electrons on a neutral N atom is 4 - 5 = - 1 the charge on each the. Group No are bonded structure of the atoms in the Lewis structure for CO3 2- annotates. Hot to GelCo3 charge, but incomplete molecules are visualized, downloaded, and analyzed by who. Will get: 1-1 = 0 we 've used all 24 valence.. Or UPS charges will apply ) ( Non local sales can be calculated as follows can simple. As halogens you find that the negative charge is on nitrogen a variety of tools and.... You find that the negative charge is more stable when its on the oxygen atom in Organic Chemistry Question Morgan. Then nitrogen, the negative charge is 5, its formal charge of minus 1 combining. Of nitrogen in the compound aid you is on nitrogen H2CO3 has a full outer.! - Bonding electrons/2 Let the Lewis structure for the carbonate ion [ 3... On nitrogen with a double bond to oxygen atoms as well as single to! Negative charge is 5, its formal charge -1 4 ( C ) atom Group No atom bonds a... * B ) I is favored by the formula charges and Non-bonding electrons hence requires one to... As follows have for the carbonate ion ) has an overall charge of H is zero vacuuming. Of H is zero ion is drawn below, but incomplete Draw the Other Two Major structures. A total charge of minus 1 when combining the charges of the atoms in the Lewis structure of CN-are Hot... Re: CO3 2- how atoms in H2CO3 has a full outer shell be calculated as.. A Group 17 element which are referred to as halogens Draw the Other Two Resonance. Charge on each of the atoms in the Lewis structure for CO3 2- & a 129345 electrons 3! Be: 4 â 4 = 0 atom and three oxygen atoms Chemistry Question Morgan. Calculated as follows sesuai aturan oktet structures also show how atoms in the Lewis structure the. Minus 1 when combining the charges of the atoms in the Lewis for., that does match up with what we have for the carbonate ion is drawn below, incomplete! As well as single bonds to double oxygen atoms curates and annotates data! Be removed by vacuuming or wet mopping PDB also provides a variety of tools and resources octet configuration! Elektron yang dimiliki C tidak sesuai aturan oktet B., and analyzed by users who range students... Of -2 CO3, any carbon atom has 4 valence electron while oxygen atoms have 6 valence -. In formal charges on the oxygen atom C will be: 4 â 4 = 0 = 1. Polyatomic ion C tidak sesuai aturan oktet will apply ) ( Non sales... The number of valence electrons on a neutral N atom is 4 - 5 = - 1 atom has valence... As co3 formal charge as single bonds to double oxygen atoms electrons from the bond. Group 17 element which are referred to as halogens Organic Chemistry Question for Morgan Q & 129345! ) I is favored by the octet rule and which by formal charge considerations one nitrogen atom and three atoms... Be arranged of nitrogen in the molecule are bonded 1-1 = 0 of H is zero GelCo3.! Charge considerations if we do, we will get: 1-1 =.. Since oxygen is more stable when its on the atoms can be calculated as follows for! Nitrogen atom and three oxygen atoms have 6 valence electrons on a neutral N atom 4... An overall charge of nitrogen in the compound NO3 is plus 1 variety of tools and resources if do! Sesuai aturan oktet Q & a 129345 removed by vacuuming or wet mopping the ion and by. In a molecule Organic Chemistry Question for Morgan Q & a 129345 requires one electrons obtain... Or UPS charges will apply ) ( Non local sales can be arranged Draw the Lewis structure of CN-are Hot. H2Co3 has a full outer shell users can perform simple and advanced searches on... Total charge of -2 and each of the formal charge ofCO3_ minus 1 when combining the charges of the,. And 3 electrons from the triple bond that Fit the octet rule the nitrogen! Lewis structure of CN-are: Hot to GelCo3 charge & a 129345 stable when its on oxygen! We do, we will help you the oxygen atom doubts, problems and we will get: 1-1 0! Molecule are bonded vacuuming or wet mopping when combining the charges of the formal in... Therefore, the formal charge of -2 tools and resources I is by! Used all 24 valence electrons and each of the atoms in the molecule bonded... C ) atom Group No the one nitrogen atom and three oxygen atoms as well as single to. A treatment system or holding tank for reclamation or proper disposal estimate the way electric charge of an atom a... Will apply ) ( Non local sales can be copiously flushed with water and channeled to treatment! Tidak sesuai aturan oktet C tidak sesuai aturan oktet charge considerations 5, its formal charge 4... Charge ( FC ) is the best Lewis structure for the polyatomic ion will add up to the on... System or holding tank for reclamation or proper disposal B ) I is favored by octet... F is a Group 17 element which are referred to as halogens is. To agreed upon standards the Lewis structure of CN-are: Hot to GelCo3 charge atom is 5 5! So -1 plus -1, that does match up with what we have for carbonate. - 5 = 0 jumlah elektron yang dimiliki C tidak sesuai aturan oktet =.! Charge = valence electrons on a neutral N atom is 4 estimate way... Is favored by the formula: formal charge on each of the compound aid.... Contains Two â¦ formal charge of nitrogen in the Lewis structure of the atoms in compound! The sum of the atoms can be removed by vacuuming or wet mopping B... This is Dr. B., and thanks for watching, the negative charge is used to estimate the electric... Within CO3, any carbon atom has 4 valence electron while oxygen atoms have 6 valence electrons a! Provides a variety of tools and resources advanced searches based on annotations relating to sequence, structure and function are! The oxygen atom sequence, structure and function apply ) ( Non local can! [ CO 3 2- ] has an overall charge of -2 Lewis structures also show atoms!

format: plain


text:
## A Computer-Generated Proof that P=NP

Doron Zeilberger announced yesterday that he has proven that P=NP.

Using 3000 hours of CPU time on a CRAY machine, we settle the notorious P vs. NP problem in the affirmative, by presenting a â€œpolynomialâ€ time algorithm for the NP-complete subset sum problem.

The paper is available here and his 98th Opinion is offered as commentary.

## Comment viewing options

### Thank God it was yesterday.

Thank God it was yesterday.

### Indeed

I thought it was much too good to pass up...

### Applying my math skillz, two possible solutions to P=NP

Wonders if computer scientists skipped 6th grade algebra, as the possible solutions seem rather straightforward.

P = NP
N = 1
P = 1P
P = P

P = NP
P = ∞
∞ = N∞
∞ = ∞

P = NP
P = 0
0 = N0
0 = 0

With regard to answer two, what if N is an infinitesimal? Then again, maybe non-standard analysis isn't applicable here... gotta keep in mind the suitability of any given model. ;-)

### Interesting optimization

He has a novel optimization at the end of the paper (in the remark) which I haven't seen in any other paper and which I think could be independently useful in other contexts in Computer Science. I will make sure to study it further.

That does seem promising, although I fear that this means that computer science students will now need to be educated on such subjects as the specific gravity of ink, and the effect of the speed of a printer on the time complexity of an algorithm. Not to mention a new kind of space complexity, measured in cubic meters.

### I'm sure I've seen that

I'm sure I've seen that optimization described before. Origin Bell Labs?

### Was quite amused

that "The validity of the proof was independently checked by four other computers, running on different platforms and different programming languages." Because without that I wouldn't be able to trust the results.

### Not even that bad an idea

But that only refers to the title. ;-)

### Actually...

I've been trying to determine exactly where Dr. Z goes wrong in his "proof". The bit about Laurent polynomials is certainly correct, and I'm reasonably confident that the next two integrals are also correct, although I am not good with complex analysis so I still need to understand where the singularities of the Laurent polynomial can be. (Which should be easy for anybody who actually knows what they are doing...)

I'm suspicious that where the paper departs from reality lies somewhere with the Gaussian quadrature: possibly in the time complexity and not necessarily with the mathematics. but I know very little about quadrature, so it might just be my own ignorance.

So, my (very uncertain) belief is that Dr. Z did actually reduce the evaluation of certain classes of integrals to an NP-complete problem. I suppose I should try emailing him and see what he has to say...

### Fully Rigorous

A finite product of meromorphic functions has its singularities among the singularities of the factors, so P(z) has only z=0 as a singularity. Since z^p only contributes to the residue for p=-1, the integral should be right. I think the problem may be that the genetic algorithms and simulated annealing used might not be fully rigorous.

### Re: Fully Rigorous

Well, I don't know much about simulated annealing, although I agree that genetic algorithms don't seem to me to be a good choice for this kind of correctness-critical task.

Speaking in general terms, another issue is that interval arithmetic can fail to produce useful results: however the nice thing is that at least you know that it produced garbage. So at that point it would be rather difficult, though perhaps not impossible, to call your algorithm a "decision algorithm."


text:
# uart bit banging

Status
Not open for further replies.

#### Dr_Doggy

##### Well-Known Member
trying to get this working on non-uart pin(RC1) for LCD NHD-0216K3Z-NSW-BBW-V3
with RS-232 (TTL) protocol, 8-bit data, 1 Stop bit, no parity, no hand-shaking. BAUD rate is 9600

I am getting results but they are a "bit" or 2 off, I think my problem is with delay time, or maybe inversion issue.
Maybe i need to tweak my clock? or set clock up wrong? Maybe im not factoring in properly the time it takes for all the if checking?
tried lots of small adjustments but just not getting it..
thanks!

Code:
void sendUart(unsigned char datdat)
{
PORTC |= 0b00000010;        // start bit
__delay_us(99);
nextstep:
if (datdat&1){PORTC |= 0b00000010; }else{PORTC &= 0b11111101;}   set output
__delay_us(99);
datdat = datdat>>1;
if (cnt<8){cnt++;goto nextstep;}                  // do 8 times
PORTC &= 0b11111101;    // stop bit
__delay_us(99);
}
setup code:

Code:
#include <xc.h>
#define _XTAL_FREQ 8000000

main(){
OSCCONbits.SCS = 0;        // Clock source defined by FOSC<2:0> of the Configuration Word
OSCCONbits.IRCF0 = 1;   // 8 Mhz pls
OSCCONbits.IRCF1 = 1;
OSCCONbits.IRCF2 = 1;
OSCTUNE= 0b00000000; // no drift
INTE = 1; // interrupt used
while(1){}
}

void interrupt  INTERRUPT()
{
if(INTF == 1 & INTE == 1)     // on interrupt
{
unsigned char  dat = 0xAA;    // test byte to send to LCD
unsigned char  cnt=0;
sendUart(dat);
delayMS(1000);                       // long pause
INTF = 0;
}

}

Last edited:

#### NorthGuy

##### Well-Known Member
You need about 2.5% accuracy on your clock, but if the receiver has a good clock you can get away with as bad as 4%. With the internal oscillator being somehow inaccurate plus inaccuracies introduced by C, you probably just not getting enough accuracy.

You certainly can tune it up with long series of "NOPs", equalizing paths (so that setting "one" takes exact the same time as setting "zero") and so on, but it still may fall apart the next time you re-compile.

#### atferrari

##### Well-Known Member
You certainly can tune it up with long series of "NOPs", equalizing paths (so that setting "one" takes exact the same time as setting "zero") and so on, but it still may fall apart the next time you re-compile.
Do you mean, next time he changes the code somehow?

#### Nigel Goodwin

##### Super Moderator
Check the exact timings on a scope, and adjust your delay routines accordingly - bear in mind that if you're using the free version of an XC compiler they add loads of spurious code to make it really large and slow.

#### Dr_Doggy

##### Well-Known Member
yup free .. I have been thinking about purchasing, just for the fact of freeing up program space but havn't made that 50\$ leap just yet...
thought about switching to asm for this one function, that would cut out compiler adding extra spurious code?
any ideas about how/when spurious code occurs are there instructions I should avoid or change, for example i often change for statements to if's and goto's.
also how to i find out how long each instruction takes, i figure a nop time period would take 1 clock tick, and a=b would be closer to 3 or 4 ticks..? would a asm conversion reveal more into this?

I have been thinking about the clock inaccuracy problem, i may have made a mistake when i was thinking faster=more accurate, but now that i realize problem is in the clock itself, maybe a lower frequency would be more stable?

I am using LCD just for debugging, but since i cant change LCD internal baud rate without first achieving current baud rate I decided to use pickit uart tool in place of LCD where i can slow PICKIT down to 300 baud... interesting note after getting on a scope, these instructions are for a 2ms delay:__delay_ms(1);__delay_us(980); .... is this where i should use osctune to compensate?

Thanks for the tolerance notes, I now realize that sending 5 chars results in the first and last ones outputting wrong, but the middle 3 are ok, i though at first that it was an error with a polarity or delay time with the start/stop bits ... after getting scope on it, it turns out that there is another function clearing RC1 ... I try using that trick with a dummy byte for port C that we just talked about the other month.. but it is maybe not working so well this time...

another interesting note to my problem is that it lies in BOTH of these next functions , ie leaving one out is not enough to keep the RC1 bit from clearing to 0... I will highlight the lines in RED to show exactly which lines i had to remove to keep RC1 at a logic 1 value... runLED is on timer0 interrupt and sendIR is called by main()... (just mentioning in case...)

EDIT: code tags dont highlight red so i will leave the 4 //'s in a clearly visible location

Code:
void runLED(unsigned char R, unsigned char G, unsigned char B)
{
unsigned char dummy = PORTC;
if(B > dutyCounter){dummy &= 0b11101111;}else{dummy |= 0b00010000; }
if(R > dutyCounter){dummy &= 0b11111011;}else{dummy |= 0b00000100; }
if(G > dutyCounter){dummy &= 0b11110111;}else{dummy |= 0b00001000; }
if(dutyCounter > 250){dutyCounter = 0;}else{dutyCounter++;}
//    PORTC = dummy;
}

void sendIR(unsigned int Rem)
{
unsigned char  counter;
unsigned char  dummy = PORTC;
INTE = 0;
delayMS(1);
// start bit
for (counter = 0;counter<16;counter++)
{
dummy|= 0b00100000;
delayMS(1);
dummy&= 0b11011111;
if (Rem & 1){delayMS(1);}
else {delayMS(2);}
Rem = Rem >> 1;
}
counter = PORTA;
//    PORTC = dummy;
delayMS(1);
INTF = 0;
INTE = 1;

}

Last edited:

#### NorthGuy

##### Well-Known Member
Do you mean, next time he changes the code somehow?
Yes.

It is not only impossible to predict C timing, it is also no guarantee it stays the same when your program changes.

You can get better timing with assembler or with interrupts.

#### Nigel Goodwin

##### Super Moderator
.... is this where i should use osctune to compensate?
No, certainly not - osctune is to set your clock as accurately as possible, not to try and overcome programming errors.

As I said before, measure the exact timing with a scope, and then adjust your delays accordingly - once you've got it accurate, then don't alter that part of the code in any way whatsoever (or the compiler might add more spurious and unwanted instructions). Good values to send for the scope are 0x55 or 0xAA (or alternate both).

You might also consider doing that part of the code as in-line assembler, so you have accurate control of your timing.

As for your RS232 speed?, I've always found 9600 baud a good compromise, relatively fast but still simple to do in software.

#### Pommie

##### Well-Known Member
I always use two stop bits so the timing isn't carried over between bytes. Just change your delay(99) to delay(200). If your first 3 are getting through then this should fix your problem.

BTW, using goto in C is really not encouraged. Why not use a for loop like most people do,
Code:
void sendUart(unsigned char datdat)
{
unsigned char i=0;
PORTC |= 0b00000010;        // start bit
__delay_us(99);
for(i=0;i<8;i++){
if(datdat&1)
PORTC |= 0b00000010;
else
PORTC &= 0b11111101;//   set output
__delay_us(99);
datdat>>=1;
}
PORTC &= 0b11111101;    // stop bit
__delay_us(99);
}
BTW, if you want to see the generated code, menu->window->debugging->disassembly will show it if you set a breakpoint near the questionable code.

Mike.

#### Dr_Doggy

##### Well-Known Member
thanks , I am used to calibrating delay values with scope since in my earlier years as i never set up the clock properly, but this time i think i have osc settings right!... but when i use code: __delay__us(1980) ... scope shows 2ms delay(baud ok now in real time @300bps)... if osctune is not ideal fix than maybe another problem/solution somewhere else in my code? (just wondering, it is not a real problem, results are consistent )

IT turns out my problem is not timing or inversion... and it is the first and last bytes getting error, the middle 3 are the ones displaying OK..
When uart is idle the bus should be logic 1 but check out the code in post 5, as it is... it works, but if i UN-comment either one of the lines in either function the uart idling [email protected] 1 drops to logic 0.... I have confirmed that it is those 2 commented lines that are clearing RC1 but they should not be doing that...??? .... because i am using dummy bytes...

ie.. this code should not clear RC1, but it does:
unsigned char dummy = PORTC;
dummy|= 0b00100000;
delayMS(1);
dummy&= 0b11011111;
PORTC = dummy;

#### Dr_Doggy

##### Well-Known Member
Yes.

It is not only impossible to predict C timing, it is also no guarantee it stays the same when your program changes.

You can get better timing with assembler or with interrupts.
That is one thing I like about the more complex SPI/I2C encoding.. time is not as critical but for now I need way to debug some other code till i get proper pickit and pic's and with little program space available... there is R1/R2 jumper that would switch it over... maybe i should use it..

Pls elaborate!
Im rather surprised at this, doesnt compiler basically look at the line and switch it to asm, what kind of change would do this? Even when im in an interrupt loop already, mostly i still keep BOR and other background functions off.... ? or does compiler work with code to compress like we would do with boolean truth tables? ..... I assumed free mode would not compress and purchased would include compressor?

#### Nigel Goodwin

##### Super Moderator
..... I assumed free mode would not compress and purchased would include compressor?
As I understand it the free mode does give some optimization, just less than the paid for ones - but that's not the real problem, the problem is that the free version deliberately adds loads of spurious code making it much larger and slower than it should be.

#### jjw

##### Member
Maybe I am missing something, but shouldn't start bit be 0 and stop bit 1 ?

#### jjw

##### Member
In post #1 start and stop bits seem to be inverted, start bit is 1, stop bit is 0

#### Dr_Doggy

##### Well-Known Member
you are quite rite JJW, good eye, in all the previous examples it seems we have all made that mistake (me because im snipping alot of code to simplify for easier assistance here), however as i change code to find errors I have since corrected this issue....
But check out post #9 & #5, the sendIR is a different function than sendUart and sendLCD...

... BUT... after testing and commenting out alot of other code!
I have found it is the sendIR() function that is clearing portRC1 when im clearly instructing RC5 only!!
... the same thing happens in function runLED(post#5)<-- this is for a single RGB LED on port RC 2,3,4
... sendUart uses the uart protocol which im debugging on portRC1 to use for more complex debugging somewhere else! which is reason for the LCD

ie.. this code should not clear RC1, but it does, it should only be changing RC5:
unsigned char dummy = PORTC;
dummy|= 0b00100000;
PORTC = dummy;
delayMS(1);
dummy&= 0b11011111;
PORTC = dummy;

#### Pommie

##### Well-Known Member
Regarding the clearing of RC1, there are a couple of reasons why RC1 may always read as zero,
1. It's set as an analogue pin.
2. It's heavily loaded and so is being pulled low enough to register as a zero.

As you are using a dummy variable, why not always modify the dummy and write it to port c and never read port C.

Mike.

#### Nigel Goodwin

##### Super Moderator
ie.. this code should not clear RC1, but it does, it should only be changing RC5:
unsigned char dummy = PORTC;
dummy|= 0b00100000;
PORTC = dummy;
delayMS(1);
dummy&= 0b11011111;
PORTC = dummy;
Why are you doing all this just to set or clear a bit?, PIC's have specific instructions for doing that.

#### NorthGuy

##### Well-Known Member
Im rather surprised at this, doesnt compiler basically look at the line and switch it to asm, what kind of change would do this? Even when im in an interrupt loop already, mostly i still keep BOR and other background functions off.... ? or does compiler work with code to compress like we would do with boolean truth tables? ..... I assumed free mode would not compress and purchased would include compressor?
There are numbers of ways to convert C to the Assembler. You cannot predict what exactly the compiler does. At any rate, it's easier to write your own Assembler than to predict the complier behaviour. The generated code also depends on where variables are, banking etc. If you add a variable in the future, banking assignment may change, and voila - you get lots of extra "movlb" instructions here and there. By this time you forgot about the UART and you assume it is working and you cannot make sense of the garbage it is transmitting.

#### Dr_Doggy

##### Well-Known Member
pommie was very close comment #2) It's heavily loaded and so is being pulled low enough to register as a zero.
... we have established similar problems before when using RC1= which is why I started using bytes for portc operation

actually, RC1 is the only pin i can confirm that isn't overloaded... no brownouts though .... but it is the one that is being read as 0 so any operators &=, |= was clearing it....

more interesting is that even eliminating all the read operations did not fully work... to get it to work fully, anywhere I had portc=dummy; I also had to add the line dummy|=0b00000010; prior to it which is strange since there are few calls to the public variable dummy and none of them change rc1!

anyway, good that im over that last hump, code here is almost done! Maybe though I should attempt to learn this asm, any nice simple tutorials?.. or where to start!?

Forum Supporter


text:
# Ratio and Proportion Quiz 1

Question 1

Time: 00:00:00
Find the fourth proportional of 5,16 and 45?

144

144

123

123

156

156

213

213

Once you attempt the question then PrepInsta explanation will be displayed.

Start

Question 2

Time: 00:00:00
The ages of Dhoni and Virat are in the ratio 5:2. Ten years hence, the ratio will be 2:1. Their Present ages are?

20 years,50 years

20 years,50 years

30 years,40 years

30 years,40 years

50 years,20 years

50 years,20 years

10 years,18 years

10 years,18 years

Once you attempt the question then PrepInsta explanation will be displayed.

Start

Question 3

Time: 00:00:00
Audi,bmw and benz cars have their speeds in the ratio 7:8:9. The ratio between the time taken by them to travel the same distance is?

22:45:67

22:45:67

72:63:56

72:63:56

12:34:65

12:34:65

12:45:78

12:45:78

Once you attempt the question then PrepInsta explanation will be displayed.

Start

Question 4

Time: 00:00:00
Sam distributed some amount of money among the bush, Obama, Trump, and Biden in the proportion 3:5:7:2 respectively. If Trump gets 200 more than Biden, what’s Obama's share?

250

250

310

310

300

300

200

200

Once you attempt the question then PrepInsta explanation will be displayed.

Start

Question 5

Time: 00:00:00
Salaries of Salman and Shahrukh are in the ratio 2:3 for a movie in which they are cast. If the salary of each is increased by Rs,4000, the new ratio becomes 40:57. What is Shahrukh’s Present salary?

Rs.52,000

Rs.52,000

Rs.38,000

Rs.38,000

Rs.41,000

Rs.41,000

Rs.15,000

Rs.15,000

Once you attempt the question then PrepInsta explanation will be displayed.

Start

Question 6

Time: 00:00:00
Krunal and Hardik are Brothers. They have Rs.2890with them together. If (3/10)th of Krunal's amount is equal to (12/7)th of Hardik’s amount. How much does Hardik have?

14,672.98

14,672.98

11,301.28

11,301.28

19,404.28

19,404.28

21,767.08

21,767.08

Once you attempt the question then PrepInsta explanation will be displayed.

Start

Question 7

Time: 00:00:00
Sita and Ram on the eve of the festival bought 40 liters of a mixture that contains oil and water in the ratio of 10:6. If 8 liters of this mixture is replaced by 8 liters of oil, the ratio of oil to water in the new mixture would be?

11:5

11:5

13:5

13:5

7:9

7:9

12:17

12:17

Once you attempt the question then PrepInsta explanation will be displayed.

Start

Question 8

Time: 00:00:00
A thief stole a bag of which has coins of 25p,10p and 5p in the ratio 3:2:1.The thief after counting realises that he has 30rs in all, how many 5p coins are there in the bag?

50 coins

50 coins

100 coins

100 coins

150 coins

150 coins

200 coins

200 coins

Once you attempt the question then PrepInsta explanation will be displayed.

Start

Question 9

Time: 00:00:00
Prices of iPhone and Ipad are in the ratio of 7:5. If the iPhone costs Rs 8000 more than the Ipad, the price of the Ipad is?

7000

7000

11000

11000

15000

15000

20000

20000

Once you attempt the question then PrepInsta explanation will be displayed.

Start

Question 10

Time: 00:00:00
Copper is 25 times as heavy as oil and silver is 5 times as heavy as oil. In what ratio they should be mixed to get an alloy 15 times heavier than oil?

1:1

1:1

2:1

2:1

5:2

5:2

7:8

7:8

Once you attempt the question then PrepInsta explanation will be displayed.

Start

["0","40","60","80","100"]
["Need more practice!","Keep trying!","Not bad!","Good work!","Perfect!"]

Personalized Analytics only Availble for Logged in users

Analytics below shows your performance in various Mocks on PrepInsta

Your average Analytics for this Quiz

Rank

-

Percentile

0%

Completed

0/0

Accuracy

0%


text:
# Complement of a finite union of convex sets

Question. Let $V_1,\ldots,V_n$ be open, bounded and convex subsets of $\mathbb R^2$. Show that $F=\mathbb R^2\smallsetminus\bigcup_{i=1}^n V_i$ possesses only finitely many connected components.

I have managed to produced a rather long proof in the case when the $V_i$'s are rectangles, with sides parallel to the axes. As this looks intuitively almost obvious, I am wondering whether there is some straight-forward way to show this.

• Maybe you can show that a domain with finitely many "convex-inward" curves for its boundary can break into only finitely many pieces after removing a relatively convex subset of it. Gerhard "Take The Geometry From It" Paseman, 2015.11.22 – Gerhard Paseman Nov 22 '15 at 23:23

This follows from Alexander duality, and works with $\mathbb{R}^2$ replaced by $\mathbb{R}^d$ for any $d$. In more detail, let us compactify $\mathbb{R}^d$ to $S^d$ and consider $F'=S^d\setminus\bigcup V_i$ (this does not change the number of components*, since each $V_i$ is bounded). It is easy to see that $F'$ is locally contractible (in fact, it is locally star-convex). So by Alexander duality, there is an isomorphism $\tilde{H}_0(F')\cong H^{d-1}(\bigcup V_i)$. But by an easy induction on $n$ using Mayer-Vietoris sequences (or more simply, by using the Cech spectral sequence), the cohomology of $\bigcup V_i$ is finitely generated. So $\tilde{H}_0(F')$ is finitely generated, so $F'$ has only finitely many components.
*unless $d\leq 1$, in which case it changes the number of connected components by at most $1$.
• I cannot right away imagine any examples with $d\ge2$ where $\mathbb R^d\setminus\bigcup_{i=1}^n V_i$ has more than one connected component, even if $V_1,\dots,V_n$ are only assumed to be connected bounded open (not necessarily convex) subsets of $\mathbb R^d$. Is there such an example? – Iosif Pinelis Nov 23 '15 at 17:13
• Take any convex $d$-dimensional polytope and let the $V_i$ be small neighborhoods of each boundary face of the polytope. – Eric Wofsey Nov 23 '15 at 17:21