Coder Social home page Coder Social logo

cs131's People

Contributors

lgqfhwy avatar mikucy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

cs131's Issues

iterative_lucas_kanade

in hw8, at iterative_lucas_kanade function
you write:
Ik = img1[y1, x1] - img2[y2, x2]
bk = np.array([np.sum(IkA1), np.sum(IkA2)])
But in equations, Ik is an array which has different values at (x,y) with x = px-w-->px+w, y=py-w-->py+w, not just a number (your code)
In my opinion, it would be Ik = img1[y1-w:y1+w+1,x1-w:x1+w+1] - img2[y2-w:y2+w+1,x2-w:x2+w+1]
with y2 = int(round(y+gy+vy)); x2 = int(round(x+gx+vx)) as mentioned in the code
image

Complete the hw4: remove object.

   Hello, I notice that you didn't complete the remove_object in the last of the hw4. I complete it, maybe not perfect.
  Below is my code:
def remove_object(image, mask):
    """Remove the object present in the mask.

    Returns an output image with same shape as the input image, but without the object in the mask.

    Args:
        image: numpy array of shape (H, W, 3)
        mask: numpy boolean array of shape (H, W)

    Returns:
        out: numpy array of shape (H, W, 3)
    """
    out = np.copy(image)

    ### YOUR CODE HERE
    from skimage import measure
    label_image = measure.label(mask)
    regions = measure.regionprops(label_image)
    region = regions[0]
    if len(regions) != 1:
        print("Maybe two objects to remove?")
        # Find the biggest area of region
        for i in regions:
            if i.area > region.area:
                region = i
    transposeImage = False
    if region.bbox[2] - region.bbox[0] < region.bbox[3] - region.bbox[1]:
        out = np.transpose(out, (1, 0, 2))
        mask = np.transpose(mask, (1, 0))
        transposeImage = True
    count = 0   # count time for all iteration
    while not np.all(mask == 0):
        energy_image = energy_function(out)
        energy_image = energy_image + energy_image * mask * (-1000)
        vcost, vpaths = compute_forward_cost(out, energy_image)
        end = np.argmin(vcost[-1])
        seam = backtrack_seam(vpaths, end)
        out = remove_seam(out, seam)
        mask = remove_seam(mask, seam)
        count += 1
    #print("count = ", count)
    out = enlarge(out, out.shape[1] + count)
    if transposeImage:
        out = np.transpose(out, (1, 0, 2))
    ### END YOUR CODE
    return out

The result is:
screen shot 2018-06-02 at 14 31 05
I notice that the result is not perfect, below is the picture provided by.
http://cs.brown.edu/courses/cs129/results/proj3/taox/
screen shot 2018-06-02 at 14 39 16
In the top right have some subtle change. I don't know how to do better. If you have some ideas
to improve it, we could achieve best result.

hw3_release Extra Credit: Stitching Multiple Images?

Hello, I am a beginner. In hw3_release Extra Credit: Stitching Multiple Images, I don't know how to do.
The problem said given a sequence of m images, then stitch an ordered chain of images. I want to take the first and second images then stitch together, formed a new images, then stitch together the third images. But it is too complex and maybe have some simple ways.
I notice that you haven't do this problem, if you have any idea, please complete the code. I am a beginner, it is too hard for me. Thank you so much.

hw4_release find_seams

Hello,
When I am working with the function find_seams, I have got the error like this:


IndexError Traceback (most recent call last)
in ()
3 # Alternatively, find k seams for removal and duplicate them.
4 start = time()
----> 5 seams = find_seams(img, W_new - W)
6 end = time()
7

~/Desktop/cv&nlp/CS131_release/hw4_release/seam_carving.py in find_seams(image, k, axis, efunc, cfunc)
331 # Store the new seam with value i+1 in the image
332 # We can assert here that we are only writing on zeros (not overwriting existing seams)
--> 333 assert np.all(seams[np.arange(H), indices[np.arange(H), seam]] == 0), "we are overwriting seams"
334 seams[np.arange(H), indices[np.arange(H), seam]] = i + 1
335

IndexError: arrays used as indices must be of integer (or boolean) type

but I didn't modify the code. Have you got any problems like this? How can I fix this error?
Hope for your reply, thanks a lot!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.