Open source Python module for computer vision

Related tags

Deep Learning PCV
Overview

About PCV

PCV is a pure Python library for computer vision based on the book "Programming Computer Vision with Python" by Jan Erik Solem.

More details on the book (and a pdf version of the latest draft) can be found at programmingcomputervision.com.

Dependencies

You need to have Python 2.6+ and as a minimum:

Some parts use:

Many sections show applications that require smaller specialized Python modules. See the book or the individual examples for full list of these dependencies.

Structure

PCV/ the code.

pcv_book/ contains a clean folder with the code exactly as used in the book at time of publication.

examples/ contains sample code. Some examples use data available at programmingcomputervision.com.

Installation

Open a terminal in the PCV directory and run (with sudo if needed on your system):

python setup.py install

Now you should be able to do

import PCV

in your Python session or script. Try one of the sample code examples to check that the installation works.

License

All code in this project is provided as open source under the BSD license (2-clause "Simplified BSD License"). See LICENSE.txt.


-Jan Erik Solem

Comments
  • Fix ROF code.

    Fix ROF code.

    The Chambolle paper this is based on -- http://www.cmap.polytechnique.fr/preprint/repository/578.pdf -- initializes Xi_0 with 0, not with g (see page 13 at the bottom).

    Consider this code:

    im = misc.lena()
    U, T = rof.denoise(im, im, tv_weight=30)
    imshow(U)
    

    Before this change, this produced the output http://i.imgur.com/u68Vakj.jpg . With this change, it produces http://i.imgur.com/3eHli7J.jpg which looks more correct.

    opened by nico 5
  • Where can we find image files?

    Where can we find image files?

    Dear Jan Erik Solem,

    Many thanks for your book, "Programming Computer Vision with Python." I'm learning how to process computer images by your book.

    Although there are many image files used in the sample programs, I could not find them in this repository. Some files have path like 'data/image.png', but I could not find such folder.

    We can find several reference sites for us to collect image files in your book. But do we have to pick up each image file to trace your sample codes?

    I'll be happy if I could have a good way to gather the image files. Thanks.

    Best, Takeshi Akutsu (@akucchan_world)

    opened by takeshi-a 3
  • sift.py plot_matches error

    sift.py plot_matches error

    function plot_matches in sift.py should contain: plot([locs1[i][0],locs2[m][0]+cols1],[locs1[i][1],locs2[m][1]])

    because in locs coordinate x comes before y

    opened by vivanov879 3
  • TypeError: a bytes-like object is required, not 'str'

    TypeError: a bytes-like object is required, not 'str'

    Traceback (most recent call last): File "imgsearch.py", line 32, in res_reg = [w[1] for w in src.query(imlist[q_ind])[:nbr_results]] # 查询的结果 File "/opt/conda/lib/python3.8/site-packages/PCV/imagesearch/imagesearch.py", line 128, in query h = self.get_imhistogram(imname) File "/opt/conda/lib/python3.8/site-packages/PCV/imagesearch/imagesearch.py", line 96, in get_imhistogram return pickle.loads(str(s[0])) TypeError: a bytes-like object is required, not 'str'

    env: python3.8.8

    opened by annyhou 2
  • Chpter 5: Multiple view geometry code?

    Chpter 5: Multiple view geometry code?

    Hi Jan-

    Any chance you could post the code from chapter 5? I wanted to mess around with the plane_sweep stuff (stereo.py) and right now it looks like that would require typing in the code manually from the book?

    -darkgreen

    opened by Ezekiel-Kruglick 2
  • IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed

    IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed

    File "gen_vocabulary.py", line 24, in voc.train(featlist, 122, 10) File "/opt/conda/lib/python3.8/site-packages/PCV/imagesearch/vocabulary.py", line 24, in train descr.append(sift.read_features_from_file(featurefiles[0])[1]) File "/opt/conda/lib/python3.8/site-packages/PCV/localdescriptors/sift.py", line 26, in read_features_from_file return f[:,:4],f[:,4:] # feature locations, descriptors IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed

    opened by annyhou 1
  • ImportError: No module named PIL

    ImportError: No module named PIL

    I'm not familiar with python, when I run the sample, it say: Traceback (most recent call last): File "/Users/leocone/Study/PCV/examples/ch1_morphology.py", line 1, in from PIL import Image ImportError: No module named PIL

    opened by yuzhidi 1
  • Run SnapSudoku on a smart phone?

    Run SnapSudoku on a smart phone?

    https://github.com/prajwalkr/SnapSudoku/issues/3

    It would be cool to get SnapSudoku running on the iPhone so that you could use the camera to do the snap and immediately solve the puzzle right on the phone. It would drive Sudoku players crazy if you could walk up with your smart phone, snap a picture of their puzzle, and show them the solution. Pythonista is a Python 2.7 and 3.5 IDE for iOS. Pythonista does support NumPy, Matplotlib, and Pillow (PIL) but does not yet support OpenCV or SciPy.

    @jesolem @nico @The-Penultimate-Defenestrator

    opened by cclauss 1
  • Harris corner detector

    Harris corner detector

    Your fix of Harris corner detector on Jan 23, 2013 would be wrong. According to Noble 1989, the corner measure is not det/trace^2, but det/trace. The original source code is right and the quotient on P.30 is wrong.

    Thank you for consideration in advance.

    opened by aizoaikawa 1
  • minor error in morphology.py

    minor error in morphology.py

    There is a minor error in morphology.py, reported here: http://oreilly.com/catalog/errataunconfirmed.csp?isbn=0636920022923

    In the above post, the reporter fixed the problem by replacing the original line

     im = 1*(im<128)
    

    with

     im = (im<128)
    

    while I fixed the problem by replacing the line with

     im = 1.0*(im<128)
    

    not sure which is more appropriate/robust.

    -Rich Signell

    opened by rsignell-usgs 1
  • Repo cleanup

    Repo cleanup

    I took the liberty of removing the *.pyc files from your repo and adding a suitable .gitignore; nothing fancy. I also took the liberty of converting all of your tabs in source files to 4 spaces. This is obviously not essential, but python always looks better to me that way.

    opened by jdagilliland 1
  • Can use graph cut to multi-label segment?

    Can use graph cut to multi-label segment?

    Hello, thanks of your contribution about such good work. I am using graph neural network to parcel brain region, however the result is not good, I want to use graph cut as post process. The inputs of my current model are: adjacency matrix (10242, 10242), feature matrix (10242, 6), label matrix (10242). The output is the probability y that each node belongs to a label, and its dimension is (10242, 36) I want to use graph cut to update y for better performance.

    I have a few questions about your code: First, it seems that your code is only for two categories. Can you do multi label tasks? Second, if I want to do post-processing, what should my input be?

    opened by tanjia123456 0
  • [HELP Needed] OSError: filename.sift not found.

    [HELP Needed] OSError: filename.sift not found.

    Hello, I am working on image feature matching and I started following the code examples of the PCV book. the following code `imname1 = './data/sample1.jpg' imname2 = './data/sample2.jpg'

    process and save features to file

    sift.process_image(imname1, 'sample1.sift') sift.process_image(imname2, 'sample2.sift')works fine and I get a message when done _" processed tmp.pgm to sample1.sift" "processed tmp.pgm to sample2.sift"_ but when I am trying to use thisl1, d1 = sift.read_features_from_file('sample1.sift') l2, d2 = sift.read_features_from_file('sample2.sift') matchscores = sift.match_twosided(d1, d2)` I get an OSError that says sample.sift not found Can you help me?

    opened by skarlant001 2
  • docs: fix simple typo, funtion -> function

    docs: fix simple typo, funtion -> function

    There is a small typo in PCV/tools/imtools.py, pcv_book/imtools.py.

    Should read function rather than funtion.

    Semi-automated pull request generated by https://github.com/timgates42/meticulous/blob/master/docs/NOTE.md

    opened by timgates42 0
  • sift --edge-thresh 10 Error: unknown flag `edge-thresh'

    sift --edge-thresh 10 Error: unknown flag `edge-thresh'

    Hello,

    I downloaded shift and while executing (this is in reference to book "programming computer Vision with python" by author Jan Erik Solem)

    what I need to do to resolve this...?

    -Thanks -Alok

    python examples/ch3_panorama.py Error: unknown flag `edge-thresh' processed tmp.pgm to ../data/Univ1.sift Traceback (most recent call last): File "examples/ch3_panorama.py", line 24, in l[i],d[i] = sift.read_features_from_file(featname[i]) File "/Users/akmishra/Development/python2.7/lib/python2.7/site-packages/PCV/localdescriptors/sift.py", line 25, in read_features_from_file f = loadtxt(filename) File "/Users/akmishra/Development/python2.7/lib/python2.7/site-packages/numpy/lib/npyio.py", line 962, in loadtxt fh = np.lib._datasource.open(fname, 'rt', encoding=encoding) File "/Users/akmishra/Development/python2.7/lib/python2.7/site-packages/numpy/lib/_datasource.py", line 266, in open return ds.open(path, mode, encoding=encoding, newline=newline) File "/Users/akmishra/Development/python2.7/lib/python2.7/site-packages/numpy/lib/_datasource.py", line 624, in open raise IOError("%s not found." % path) IOError: ../data/Univ1.sift not found.

    opened by manilal2 1
  • ValueError: cannot reshape array of size 14 into shape (3)

    ValueError: cannot reshape array of size 14 into shape (3)

    Hello, when lauch the code with an image, according to Programing Computer visión book, i get the following issue:

    ValueError: cannot reshape array of size 14 into shape (3)

    please, could you help me? thanks

    opened by jesuscoppelia 0
Owner
Jan Erik Solem
Jan Erik Solem
Open Source Differentiable Computer Vision Library for PyTorch

Kornia is a differentiable computer vision library for PyTorch. It consists of a set of routines and differentiable modules to solve generic computer

kornia 7.6k Jan 4, 2023
Hand Gesture Volume Control | Open CV | Computer Vision

Gesture Volume Control Hand Gesture Volume Control | Open CV | Computer Vision Use gesture control to change the volume of a computer. First we look i

Jhenil Parihar 3 Jun 15, 2022
This repository contains the source code of our work on designing efficient CNNs for computer vision

Efficient networks for Computer Vision This repo contains source code of our work on designing efficient networks for different computer vision tasks:

Sachin Mehta 386 Nov 26, 2022
PaddleRobotics is an open-source algorithm library for robots based on Paddle, including open-source parts such as human-robot interaction, complex motion control, environment perception, SLAM positioning, and navigation.

简体中文 | English PaddleRobotics paddleRobotics是基于paddle的机器人开源算法库集,包括人机交互、复杂运动控制、环境感知、slam定位导航等开源算法部分。 人机交互 主动多模交互技术TFVT-HRI 主动多模交互技术是通过视觉、语音、触摸传感器等输入机器人

null 185 Dec 26, 2022
An open source bike computer based on Raspberry Pi Zero (W, WH) with GPS and ANT+. Including offline map and navigation.

Pi Zero Bikecomputer An open-source bike computer based on Raspberry Pi Zero (W, WH) with GPS and ANT+ https://github.com/hishizuka/pizero_bikecompute

hishizuka 264 Jan 2, 2023
TACTO: A Fast, Flexible and Open-source Simulator for High-Resolution Vision-based Tactile Sensors

TACTO: A Fast, Flexible and Open-source Simulator for High-Resolution Vision-based Tactile Sensors This package provides a simulator for vision-based

Facebook Research 255 Dec 27, 2022
Rohit Ingole 2 Mar 24, 2022
PyTorchCV: A PyTorch-Based Framework for Deep Learning in Computer Vision.

PyTorchCV: A PyTorch-Based Framework for Deep Learning in Computer Vision @misc{CV2018, author = {Donny You ([email protected])}, howpubl

Donny You 40 Sep 14, 2022
Build fully-functioning computer vision models with PyTorch

Detecto is a Python package that allows you to build fully-functioning computer vision and object detection models with just 5 lines of code. Inferenc

Alan Bi 576 Dec 29, 2022
Implementation of self-attention mechanisms for general purpose. Focused on computer vision modules. Ongoing repository.

Self-attention building blocks for computer vision applications in PyTorch Implementation of self attention mechanisms for computer vision in PyTorch

AI Summer 962 Dec 23, 2022
Datasets, Transforms and Models specific to Computer Vision

torchvision The torchvision package consists of popular datasets, model architectures, and common image transformations for computer vision. Installat

null 13.1k Jan 2, 2023
Repository providing a wide range of self-supervised pretrained models for computer vision tasks.

Hierarchical Pretraining: Research Repository This is a research repository for reproducing the results from the project "Self-supervised pretraining

Colorado Reed 53 Nov 9, 2022
A PyTorch-Based Framework for Deep Learning in Computer Vision

TorchCV: A PyTorch-Based Framework for Deep Learning in Computer Vision @misc{you2019torchcv, author = {Ansheng You and Xiangtai Li and Zhen Zhu a

Donny You 2.2k Jan 9, 2023
Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition

Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition

null 107 Dec 2, 2022
This project demonstrates the use of neural networks and computer vision to create a classifier that interprets the Brazilian Sign Language.

LIBRAS-Image-Classifier This project demonstrates the use of neural networks and computer vision to create a classifier that interprets the Brazilian

Aryclenio Xavier Barros 26 Oct 14, 2022
[CVPR 2021] "The Lottery Tickets Hypothesis for Supervised and Self-supervised Pre-training in Computer Vision Models" Tianlong Chen, Jonathan Frankle, Shiyu Chang, Sijia Liu, Yang Zhang, Michael Carbin, Zhangyang Wang

The Lottery Tickets Hypothesis for Supervised and Self-supervised Pre-training in Computer Vision Models Codes for this paper The Lottery Tickets Hypo

VITA 59 Dec 28, 2022
A framework for analyzing computer vision models with simulated data

3DB: A framework for analyzing computer vision models with simulated data Paper Quickstart guide Blog post Installation Follow instructions on: https:

3DB 112 Jan 1, 2023
It's final year project of Diploma Engineering. This project is based on Computer Vision.

Face-Recognition-Based-Attendance-System It's final year project of Diploma Engineering. This project is based on Computer Vision. Brief idea about ou

Neel 10 Nov 2, 2022