1 of 10

Fill the Walls - Draft

PA 01 - Spring 2021

CS 3353 - Intro to Algorithms

SMU - Mark Fontenot, PhD

2 of 10

Overview

  • Place images on walls for gallery showing to maximize profit
  • Two walls, dimensions given as cmd line args (slight change from what I told you before)
  • Implement three placement algorithms
    • Smallest first
    • Most expensive first
    • Your developed heuristic algorithm

  • Due Feb 22, 2021 6am via a forthcoming GitHub Assignments Link
  • You may do this in groups of two students or individually.

3 of 10

Suppose that ...

Note: We will only be working with Jpeg.

4 of 10

Fill the Wall with Pictures

5 of 10

Gallery Walls - from command line args

Wall 1

Wall 2

height in px

width in px

6 of 10

CImg Library

height

width

CImg<unsigned char> image(“img01.jpg”);

7 of 10

Example Output for 1 Wall

algo01.jpeg

8 of 10

Input

  • Command-line args for everything except images. Args are:
    • directory name of images.
    • wall 1 width
    • wall 1 height
    • wall 2 width
    • wall 2 height
    • ./placement images/set1/ 10000 4000 12000 4000
  • Sticker price of each picture will be name of the file (minus the extension)
    • from this, you can infer no two pictures have the same price
    • example: 1499.jpg would be a picture that would sell for $1499.

9 of 10

Output

  • 6 image files
    • 1 per wall per algorithm
  • A text file containing the following (add headers and labels to identify everything)
    • For each algorithm:
      • Wall 1 total value
      • Wall 2 total value
      • Wall 1 % wasted space
      • Wall 2 % wasted space
      • Total profit

10 of 10

Where to start...

  • Download CImg Library (https://cimg.eu)
  • Look at the Tutorial Page
    • Try to make the tutorial code work
  • Have a look at the examples directory.
    • In particular, take a look at the CMake file.
  • Take two images and construct a new, bigger image that contains both of them.