{ "info": { "author": "Vic Jackson", "author_email": "mr.vic.jackson@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "vtools\n============\n\nvimg README rev.003 2017/7/21\nThis library is a project that is the result of my foray into the realm of computer vision.\nThis project is a direct result of exploring and thinking about a highly simple and intuitive\nway to create an image object, and then easily be able to perform a powerful set of\nmethodological analyses on that object, making routine tasks like thresholding and contouring\na simple endeavor following an object oriented approach.\n\n\nI want to pay all due homage to Dr. Adrian Rosebrock in many ways for the content of this package.\nHis website is http://www.pyimagesearch.com/ . I've read his book and his blog posts about OpenCV\nfor a long time (and am now enrolled and working through his PyImageSearch Gurus course) and this\npackage is a direct result from the knowledge that I have gained while and since doing so. This package\nborrows/adapts some of the work that Dr. Rosebrock has written in his open source 'imutils' package\nlocated here: https://pypi.python.org/pypi/imutils\n\n\nThe vImg class (Visual Tools Image) is designed as a subclass of numpy's ndarray type that extends\nndarray to include operations that computer vision (CV) researchers and practitioners use frequently to\nanalyze images and procure valuable data from. In order to accomplish this, we lean heavily on computer\nvision libraries that are already in place and usually optimized with code written in C to maximize\nperformance. This class, therefore, serves to turn images (which I would argue lend themselves inherently\nto an object-oriented approach) into objects, from which methods may be called individually or chained in\na single statement in order to rapidly prototype ideas and serve as an efficient medium that is able\nto explore challenging conceptual image analysis operations in a simple manner.\n\n\nWhen writing this class, I've opted to approach this goal with simplicity of use at the forefront, so you\nwill likely see some areas where efficiency could be improved. That being said, I also wanted to maintain\nthe ability to fine-tune parameters and dial in accuracy, so that option remains available (usually through\nparameter and keyword tuning). Efficiency has not been cast asunder either; any means that I have had\nto optimize I have attempted to implement. I know there are opportunities for improvement, and I am very\nopen to suggestion as well as any potential collaborators.\n\n\nI have done my best to maintain this hierarchy throughout the codebase and provide a well-documented tool\nthat will hopefully one day be used by more than just myself. For the time being though, I am treating this\nendeavor as an exercise both in creating a package (this is my first), and to create a\n\n\n\nDependencies\n------------\nOpenCV 3.0+ (required)\n\nPython 3.6+ (required)\n\nMahotas (required)\n\nscikit-image (required)\n\nmatplotlib (required, tested with 2+)\n\n\n\nInstall vtools\n--------------------\n**From Source**\n\nYou should be able to clone this repository in to a directory (ex: vtools) and run setup.py:\n\n cd vtools && python setup.py install\n\n\n**From PyPI**\n\n pip install vtools\n\nGetting Started\n---------------\n\nThresholding (simple binary) an image before vtools' vImg class:\n\n # Read in the image\n\n image = cv2.imread('../images/trex.png')\n\n # Convert to grayscale and apply gaussian blur\n \n gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)\n\n # Set gaussian blur k (size of weighted mean area),\n\n # must be odd so there's a center pixel\n \n k = 3\n\n gauss = cv2.GaussianBlur(gray, (k,k), 0)\n\n # Now set the threshold level, T\n \n T = 215\n\n # Next, apply the threshold to the image\n \n thresh = cv2.threshold(gauss, T, 255, cv2.THRESH_BINARY_INV)[1]\n\nThresholding (simple binary) an image using vtools.vImg:\n\n image = vImg('../images/trex.png')\n\n thresh = image.threshold(215)\n\nnote: currently the only required variable is for T, but k (defaults to 5) and\ninverse (bool, defaults to True) are also available as named parameters.\n\nThe vContour class:\n\ncalculating contours and evaluating contour properties before vtools.vimg:\n\n image = cv2.imread('quiz1.png')\n\n _, cnts, _ = cv2.findContours(thresh.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)\n\n hullImage = np.zeros(gray.shape[:2], dtype=\"uint8\")\n\n # loop over the contours\n \n for (i, c) in enumerate(cnts):\n \n # compute the area of the contour along with the bounding box\n\n # to compute the aspect ratio\n\n print(f'Contour {i} type({type(c)})')\n\n area = cv2.contourArea(c)\n\n x, y, w, h = cv2.boundingRect(c)\n\n x2, y2 = x + w, y + h\n\n\n # compute the aspect ratio of the contour, which is simply the width\n\n # divided by the height of the bounding box\n \n aspectRatio = w / float(h)\n\n\n # use the area of the contour and the bounding box area to compute\n\n # the extent\n \n extent = area / float(w * h)\n\n\n # compute the convex hull of the contour, then use the area of the\n\n # original contour and the area of the convex hull to compute the\n\n # solidity\n \n hull = cv2.convexHull(c)\n\n hullArea = cv2.contourArea(hull)\n\n solidity = area / float(hullArea)\n\n\n # compute the center (tuple)\n \n center = ((x + x2) / 2, (self. + y2) / 2)\n\n\n # visualize the original contours and the convex hull and initialize\n\n # the name of the shape\n \n cv2.drawContours(hullImage, [hull], -1, 255, -1)\n\n cv2.drawContours(image, [c], -1, (240, 0, 159), 3)\n\n print(f'Shape #{i}: Aspect Ratio is {aspectRatio:.2f}, hull area is {hullArea:.2f}, '\n f'solidity is {solidity:.2f}, extent is {extent:.2f}, center is {center}')\n\n\nEvaluating contours for usefulness with vtools' vImg, vContour, and vContours classes:\n\n img = vImg(\"images/test.png\")\n\n # outline each contour one by one and print simple and advanced contour properties\n\n # allowing you to easily determine whether contours may be useful to your CV application\n \n img.gray().evalContours()\n\n # the evalContours() method defaults to using the vImg simpleContours function with default parameters,\n\n # but you can also supply your own calculated contour values (in the form of a list of vContours)\n\n\nHistograms with vtools' vImg\n\n*** Coming Soon! ***", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/etherwar/vtools/archive/master.zip", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/etherwar/vtools", "keywords": "vtools", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "vtools", "package_url": "https://pypi.org/project/vtools/", "platform": "", "project_url": "https://pypi.org/project/vtools/", "project_urls": { "Download": "https://github.com/etherwar/vtools/archive/master.zip", "Homepage": "https://github.com/etherwar/vtools" }, "release_url": "https://pypi.org/project/vtools/0.0.35/", "requires_dist": null, "requires_python": "", "summary": "Visual Tools - an object oriented approach to image processing and analysis.", "version": "0.0.35" }, "last_serial": 3458275, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "79236903b6c3e76b9df86c00385eba45", "sha256": "d53266ac5e35bcfa8206cc090913f9a621ae48c4336e7b472c17dae6baa9c94b" }, "downloads": -1, "filename": "vtools-0.0.2-py3.6.egg", "has_sig": false, "md5_digest": "79236903b6c3e76b9df86c00385eba45", "packagetype": "bdist_egg", "python_version": "3.6", "requires_python": null, "size": 26811, "upload_time": "2017-05-01T02:52:31", "url": "https://files.pythonhosted.org/packages/5f/fd/516b3ff0f25770c37354656cdc906afe463ba88ab64d222053198cbc6237/vtools-0.0.2-py3.6.egg" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "e122361e0be742bbccea06ebaba573d9", "sha256": "49bd5458f03769e69dfac2f77987bf6ebeff40996c0e453bc1b4931f048d1996" }, "downloads": -1, "filename": "vtools-0.0.2.tar.gz", "has_sig": false, "md5_digest": "e122361e0be742bbccea06ebaba573d9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14120, "upload_time": "2017-05-01T03:28:14", "url": "https://files.pythonhosted.org/packages/2a/77/1404a3012543c5b8a476bb49afd70266f696eadee90c581d2d1a03f76894/vtools-0.0.2.tar.gz" } ], "0.0.21": [ { "comment_text": "", "digests": { "md5": "316166c6118483d42d42f4997410ba5a", "sha256": "0ba00708478ca6e28414b3a1410a91f8b0cdaa9a75555a62bb397c434112fb5c" }, "downloads": -1, "filename": "vtools-0.0.21.tar.gz", "has_sig": false, "md5_digest": "316166c6118483d42d42f4997410ba5a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14414, "upload_time": "2017-05-01T16:49:14", "url": "https://files.pythonhosted.org/packages/bb/76/363bc1ff266604cb7d6042faf4d68e16f326bfba7aa3d8dbdb878654c283/vtools-0.0.21.tar.gz" } ], "0.0.22": [ { "comment_text": "", "digests": { "md5": "54b0c14f264f020e1557c6dcd22afe36", "sha256": "4b62f1aebfe5017edb6d604a03449eae6e49b4fc67acd982d75c1fa5e365c62f" }, "downloads": -1, "filename": "vtools-0.0.22.tar.gz", "has_sig": false, "md5_digest": "54b0c14f264f020e1557c6dcd22afe36", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14651, "upload_time": "2017-05-01T19:38:49", "url": "https://files.pythonhosted.org/packages/aa/4a/560709defccaece761ee48d6939a2b1573f96e8ba82cd69d52514585c478/vtools-0.0.22.tar.gz" } ], "0.0.25": [ { "comment_text": "", "digests": { "md5": "6d1817522475626c9bc85658157ea282", "sha256": "aea19e01898f0046cb9f3cabc54cf272923d29d5cb85003e9a5f12e0395fa04d" }, "downloads": -1, "filename": "vtools-0.0.25.tar.gz", "has_sig": false, "md5_digest": "6d1817522475626c9bc85658157ea282", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23281, "upload_time": "2017-05-30T17:13:47", "url": "https://files.pythonhosted.org/packages/02/d1/c5b2bb9056a247228cfe6d5c66e01b5ef4aab96a5d07c50e9408f49621ab/vtools-0.0.25.tar.gz" } ], "0.0.26": [ { "comment_text": "", "digests": { "md5": "2f1822ff6278c798238d3127d640eaca", "sha256": "5af107a5db30eb8f8e7e7ecf916a2aa899756f2e1e08918db1a8b71e4fbf189f" }, "downloads": -1, "filename": "vtools-0.0.26.tar.gz", "has_sig": false, "md5_digest": "2f1822ff6278c798238d3127d640eaca", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23396, "upload_time": "2017-06-01T19:30:26", "url": "https://files.pythonhosted.org/packages/c7/30/619dd307c09abb937df08cd7d2668e2c4f5c57b33723c725a8a01082dfb0/vtools-0.0.26.tar.gz" } ], "0.0.27": [ { "comment_text": "", "digests": { "md5": "fb6a2f73630bf7e42d3c64a7a39b59c2", "sha256": "0b2f28ffd6689970f240369ade06731b53e44f9d2c2f11a2fb8ba9e2aa8f3288" }, "downloads": -1, "filename": "vtools-0.0.27.tar.gz", "has_sig": false, "md5_digest": "fb6a2f73630bf7e42d3c64a7a39b59c2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23388, "upload_time": "2017-06-02T19:10:04", "url": "https://files.pythonhosted.org/packages/e9/6f/85929e05b133046a7c14e245fa7ab2a722a45a4cfe9b7ab9bff10376a369/vtools-0.0.27.tar.gz" } ], "0.0.28": [ { "comment_text": "", "digests": { "md5": "813a35d41e9ef863e9fb3eb52628f430", "sha256": "ffa23bf27ac11fc2e8c736dc9cb9f0ce883893d25145003d0477f5dec13cb5d0" }, "downloads": -1, "filename": "vtools-0.0.28.tar.gz", "has_sig": false, "md5_digest": "813a35d41e9ef863e9fb3eb52628f430", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23517, "upload_time": "2017-06-02T20:22:27", "url": "https://files.pythonhosted.org/packages/23/a2/a062bc461c2d93b1d045eb4b353a217b84a68082de9119997785199e110d/vtools-0.0.28.tar.gz" } ], "0.0.29": [ { "comment_text": "", "digests": { "md5": "928be2ad6a94dee25e51960157e2ba85", "sha256": "1a3111aa55f18e6e30eea19b4e9d72dac65dc30ee0b6c366ff37371384471850" }, "downloads": -1, "filename": "vtools-0.0.29.tar.gz", "has_sig": false, "md5_digest": "928be2ad6a94dee25e51960157e2ba85", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23458, "upload_time": "2017-06-02T20:31:18", "url": "https://files.pythonhosted.org/packages/82/b0/7bbd91e99f019e9b0d27cdf726ea0794d209fad3353cbcc066ff0dc71704/vtools-0.0.29.tar.gz" } ], "0.0.31": [ { "comment_text": "", "digests": { "md5": "c9f0f9875796dbd88e7e89c91ba164ce", "sha256": "ac52ae7f6647d51bd75ec57252f4484633a572564a99b505d889e46652fe578f" }, "downloads": -1, "filename": "vtools-0.0.31.tar.gz", "has_sig": false, "md5_digest": "c9f0f9875796dbd88e7e89c91ba164ce", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 28688, "upload_time": "2017-07-10T19:09:53", "url": "https://files.pythonhosted.org/packages/1f/37/d3e646c1b96c09ddcf707a57cf82d31518c146fe3171761666b743e96870/vtools-0.0.31.tar.gz" } ], "0.0.32": [ { "comment_text": "", "digests": { "md5": "6cb8e734531c26de5a9bec918fdfb7f9", "sha256": "6c9e065a2bb8734763cd3374b43dbd29cb0881c13c8c80ced3ae5b7b296fcc8e" }, "downloads": -1, "filename": "vtools-0.0.32.tar.gz", "has_sig": false, "md5_digest": "6cb8e734531c26de5a9bec918fdfb7f9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 29118, "upload_time": "2017-07-11T03:41:21", "url": "https://files.pythonhosted.org/packages/29/eb/56c3935b7e5e8c255072e2461db82b6fba261d4f940512c9eb1e257fa7a8/vtools-0.0.32.tar.gz" } ], "0.0.35": [ { "comment_text": "", "digests": { "md5": "faefaeac2e84e792d2f8ce863f4b90b1", "sha256": "f53aa2ee3c575a42d24db7f1436ea12ffe79b1b7d4d7cd4a58b38bf8f6042fe0" }, "downloads": -1, "filename": "vtools-0.0.35.tar.gz", "has_sig": false, "md5_digest": "faefaeac2e84e792d2f8ce863f4b90b1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 34360, "upload_time": "2017-10-12T17:56:13", "url": "https://files.pythonhosted.org/packages/16/0b/3305f5297f3eecb9d0ed396b010cf6fea33addaf0061af1fd589e44722ed/vtools-0.0.35.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "faefaeac2e84e792d2f8ce863f4b90b1", "sha256": "f53aa2ee3c575a42d24db7f1436ea12ffe79b1b7d4d7cd4a58b38bf8f6042fe0" }, "downloads": -1, "filename": "vtools-0.0.35.tar.gz", "has_sig": false, "md5_digest": "faefaeac2e84e792d2f8ce863f4b90b1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 34360, "upload_time": "2017-10-12T17:56:13", "url": "https://files.pythonhosted.org/packages/16/0b/3305f5297f3eecb9d0ed396b010cf6fea33addaf0061af1fd589e44722ed/vtools-0.0.35.tar.gz" } ] }