CSCE 3110 – Project 1

 

CSCE 3110 – Project 1 

 

PROGRAM DESCRIPTION

In this programming assignment, you will (1) write a complete C++ program to

implement multiplication operations as directed and (2) perform an analysis with respect

to the theoretical and experimental running time complexity.

The following C++ code for the multiply function computes the product of two

operands using only addition: 

int multiply(int operand1, int operand2)

{

 int multiplier   = (operand1 < operand2) ? operand1 : operand2;

 int multiplicand = (operand1 > operand2) ? operand1 : operand2;

 int product = 0;

 for (int i = 0; i < multiplier; i++)

 { 

  product += multiplicand;

 }

 return product;

This function as given runs in �(���(��������, ��������)), which is a linear time

algorithm. We would, however, like for this algorithm to run faster, which can reduce the

time complexity to �(���(��� �������� , ��� �������� )) by using only addition, bit

shifting, and possibly the bitwise & operator. Therefore, your objective for this

programming assignment is to write a new function called bitMultiply, accepting the

same two parameters, to reduce the time complexity of this operation. 

Some background on bit shifting: For some variable operand and number n, a bit shift

is written as either operand = operand << n; or operand = operand >> n;,

where the << operator left shifts the bits in operand by n bits and fills in the opened

positions with 0’s while the << operator right shifts the bits in operand by n bits,

throwing away the lower order n bits and replacing higher order bits with 0’s. The <<

operator corresponds to multiplying the number by 2

!

, while the >> operator 

corresponds to dividing the number by 2

!

. For example, the decimal value 10 is 

represented internally by the bit string 1010, so if we left shift 10 by 2 bits, we obtain

101000, which can be verified to be 10 × 2

!

. As another hint, C++ supports the bitwise 

& operator that performs a bitwise “and” of two integers that can be helpful in inspecting

the bits of an integer. 

To show this improvement in time complexity, we define the requirements for this

program: 

• You will prompt for and read in two operands as positive integers (i.e., > 0). Since 

we are using bit shifting, you will limit the resulting product to the maximum 

positive value supported by integers, so that if the product exceeds this value you

will print an error message and terminate the program. If the user enters a nonpositive

value,

you

will

simply

continue

to

re-prompt

the

user

until

he/she

enters

a

 

 

 

CSCE 3110 – Project 1 

 

Due: 11:59 PM on Wednesday, May 29, 2019

valid positive integer. You may assume that the user enters an integer, though

possibly out of range, for this assignment. 

• For the multiplication operation provided by the multiply function, you will

perform this operation 10 times, calculating the amount of time in nanoseconds

that it takes to complete each time, and then find the average of all 10 of the

passes. 

• You will then write a new function called bitMultiply, accepting the same two

operands as parameters, and compute the product of the two operands using

only bit shifting, addition, and perhaps use of the bitwise & operator. Similarly,

you will perform this operation 10 times, calculating the amount of time in

nanoseconds that it takes to complete each time, and then find the average of all

10 of the passes. 

ANALYSIS REQUIREMENTS

Perform several runs of your program, ranging from product calculations using small

integers to product calculations using large integers (but not overflowing the integer

data structure). If your bitMultiply program was done correctly, you should see a

significant improvement in the amount of time needed to perform the calculations, but

did it improve by the expected amount? Include a screen shot (or typescript) of your

program performing several runs with various inputs and write a one or two paragraph

analysis of your results that describes whether or not you achieved the results you

expected. Plot your results on the same graph, where the size can be used for the xaxis

and

the

running

time

in

nanoseconds

can

be

used

for

the

y-axis.

Since

the

values

are

fairly large (i.e., in nanoseconds), you may wish to plot your results using the

logarithmic values as needed. Provide some explanation or justification on why your

results did or did not meet the expected performance metrics. 

SAMPLE OUTPUT (input shown in bold):

$ ./a.out

Enter first  positive integer: 3847849

Enter second positive integer: 9573535

Error: Product results in integer overflow.

$ ./a.out

Enter first  positive integer: 134

Enter second positive integer: 8531

Multiplication using only ADDITION:

Product: 1143154

Pass  1: 0 seconds 25371 nanoseconds

Product: 1143154

Pass  2: 0 seconds 2528 nanoseconds 

Product: 1143154 

Pass  3: 0 seconds 2295 nanoseconds

Product: 1143154

Pass  4: 0 seconds 2428 nanoseconds 

 

 

 

CSCE 3110 – Project 1 

 

Due: 11:59 PM on Wednesday, May 29, 2019

Product: 1143154

Pass  5: 0 seconds 2219 nanoseconds

Product: 1143154

Pass  6: 0 seconds 2446 nanoseconds

Product: 1143154

Pass  7: 0 seconds 5348 nanoseconds

Product: 1143154

Pass  8: 0 seconds 2247 nanoseconds

Product: 1143154

Pass  9: 0 seconds 2227 nanoseconds

Product: 1143154

Pass 10: 0 seconds 2334 nanoseconds

Average: 0 seconds 4944.3 nanoseconds

Multiplication using only ADDITION and BIT SHIFTS:

Product: 1143154

Pass  1: 0 seconds 2384 nanoseconds

Product: 1143154

Pass  2: 0 seconds 1908 nanoseconds

Product: 1143154

Pass  3: 0 seconds 1992 nanoseconds

Product: 1143154

Pass  4: 0 seconds 2065 nanoseconds

Product: 1143154

Pass  5: 0 seconds 1848 nanoseconds

Product: 1143154

Pass  6: 0 seconds 1887 nanoseconds

Product: 1143154

Pass  7: 0 seconds 2278 nanoseconds

Product: 1143154

Pass  8: 0 seconds 2123 nanoseconds

Product: 1143154

Pass  9: 0 seconds 1866 nanoseconds

Product: 1143154

Pass 10: 0 seconds 1892 nanoseconds

Average: 0 seconds 2024.3 nanoseconds

$ ./a.out

Enter first  positive integer: 0

Enter first  positive integer: 3834852

Enter second positive integer: -3481

Enter second positive integer: 348721

Multiplication using only ADDITION:

Product: 1558595236

Pass  1: 0 seconds 922810 nanoseconds

Product: 1558595236

Pass  2: 0 seconds 960872 nanoseconds 

 

 

 

CSCE 3110 – Project 1 

 

Due: 11:59 PM on Wednesday, May 29, 2019

Product: 1558595236

Pass  3: 0 seconds 967389 nanoseconds

Product: 1558595236

Pass  4: 0 seconds 975816 nanoseconds

Product: 1558595236

Pass  5: 0 seconds 916739 nanoseconds

Product: 1558595236

Pass  6: 0 seconds 939650 nanoseconds

Product: 1558595236

Pass  7: 0 seconds 942581 nanoseconds

Product: 1558595236

Pass  8: 0 seconds 974544 nanoseconds

Product: 1558595236

Pass  9: 0 seconds 947730 nanoseconds

Product: 1558595236

Pass 10: 0 seconds 903583 nanoseconds

Average: 0 seconds 945171 nanoseconds

Multiplication using only ADDITION and BIT SHIFTS:

Product: 1558595236

Pass  1: 0 seconds 4188 nanoseconds

Product: 1558595236

Pass  2: 0 seconds 3368 nanoseconds

Product: 1558595236

Pass  3: 0 seconds 6116 nanoseconds

Product: 1558595236

Pass  4: 0 seconds 3206 nanoseconds

Product: 1558595236

Pass  5: 0 seconds 3203 nanoseconds

Product: 1558595236

Pass  6: 0 seconds 4097 nanoseconds

Product: 1558595236

Pass  7: 0 seconds 4066 nanoseconds

Product: 1558595236

Pass  8: 0 seconds 3302 nanoseconds

Product: 1558595236

Pass  9: 0 seconds 5067 nanoseconds

Product: 1558595236

Pass 10: 0 seconds 5433 nanoseconds

Average: 0 seconds 4204.6 nanoseconds 

REQUIREMENTS

• Your code should be well documented in terms of comments. For example, good

comments in general consist of a header (with your name, course section, date, 

 

 

assignment help

Answer  each these questions in a paragraph with at least five sentences:  Include the question and number your responses accordingly. Provide a  citation for each answer.

1. What kind of speech was the First Amendment written to protect?

2. Does the First Amendment apply only to spoken words?

3. What does it mean that laws regulating speech must be content neutral?

4. Why are common carriers prohibited from controlling the content of the material they carry? 

5. How does the Supreme Court determine whether material is obscene?

6. Why have attempts to censor the Internet failed in the US?

7. Why not just ban spam? 

8. Why did Facebook ban Alex Jones and Louis Farrakan?

9. Should websites that show how to 3d print guns be banned? 

10. According to the Supreme Court ‘anonymity is a shield from the tyranny of the majority’. What does that mean? 

response

 

businesses seem to move more towards e-commerce and utilization of technology. As the use of the web increases, consumers are turning to shopping online. This may be for many reasons including, time-saving, brand visibility, offers, messaging, personal recommendations and many more (Singhal, & Tanwar, 2021). Shopping online allows consumers many more options than shopping in person would. Businesses also have many options when it comes to B2B commerce. In the planning process they analyze many options to decide what manufacture to go with and what price will be agreed upon. B2C has a more simple process that often does take as long between business and consumer. Nice job and good luck in your future endeavors. 

Singhal, S., & Tanwar, P. (2021). A prediction model for benefitting e-commerce through usage of regional data: A new framework. IAES International Journal of Artificial Intelligence, 10(4), 1009-1018. doi:https://doi.org/10.11591/ijai.v10.i4.pp1009-1018

Assignment Question

This is a required assignment, worth 45 points, and must be submitted by the due date.
Review the Grading Rubric before completing this assignment.Research a scholarly paper  on “Data Flow Diagrams and Data Dictionaries” and reflect on only one of the following topics:

  • “Useful DFD”: When would a Data Flow Diagram be the most useful? 
  • “DFD Processes”: What processes are most likely to use DFDs? 
  • “Dictionaries”: Who is the audience for Data Dictionaries and how important is it for end-users to understand their data?

NOTE: 
This paper must be between 250-300 words on what caught your eye and reflect on what you read. 
Do not add extraneous text that does not address the question – do not add an introduction or conclusion.
Do not copy and paste text from the referenced resource.You must provide at least one APA reference for your resource and corresponding in-text citations..
You must provide the referenced resource URL/DOI in the APA reference.
Do not use the Textbook as a referenced resource.

Project management ……99999

 Please review the attached RFP for instructions regarding the group project. The REQS document will give you detailed system requirements which you may consider incorporating into your prototype. 

Computer vision

1   (Camera Models- 20 points)  Prove that the vector from the viewpoint of a pinhole camera to the vanishing point (in the image plane) of a set of 3D parallel lines is parallel to the direction of the parallel lines. Please show the steps of your proof.

Hint: You can either use geometric reasoning or algebraic calculation. 

If you choose to use geometric reasoning, you can use the fact that the projection of a 3D line in space is the intersection of its “interpretation plane” with the image plane.  Here the interpretation plane (IP) of a 3D line is a plane passing through the 3D line and the center of projection (viewpoint) of the camera.  Also, the interpretation planes of two parallel lines intersect in a line passing through the viewpoint, and the intersection line is parallel to the parallel lines.

If you select to use algebraic calculation, you may use the parametric representation of a 3D line: P = P0 +tV, where P= (X,Y,Z)T is any point on the line (here  T denote for transpose),   P0 = (X0,Y0,Z0)T is a given fixed point on the line, vector V = (a,b,c)T represents the direction of the line, and t is the scalar parameter that controls the distance (with sign) between P and P0.

If you want to use the determinant formed by three 3D points, you will need to explain details of both the meaning of the determinant, and the steps to arrive your conclusion. Finding a solution somewhere online and copy it in your submission doesn’t work for you.

2. (Camera Models- 20 points) Show that relation between any image point (xim, yim)T of a plane (in the form of (x1,x2,x3)T in projective space ) and its corresponding point (Xw, Yw, Zw)T on the plane in 3D space can be represented by a 3×3 matrix. You should start from the general form of the camera model (x1,x2,x3)T = MintMext(Xw, Yw, Zw, 1)T, where M = MintMext is a 3×4 matrix, with the image center (ox, oy), the focal length f, the scaling factors( sx and sy),  the rotation matrix R and the translation vector T all unknown. Note that in the course slides and the lecture notes, I used a simplified model of the perspective project by assuming ox and oy are known and sx = sy =1, and only discussed the special cases of planes.. So you cannot directly copy those equations I used. Nor can you simply derive the 3×4 matrix M.  Instead you should use the general form of the projective matrix (5 points), and the  general form of a plane nx Xw + ny Yw + nz Zw  = d (5 points), work on an integration (5 points), to form a 3×3 matrix between a 3D point on the plane and its 2D image projection (5 points).

3.  (Calibration- 20 points )  Prove the Orthocenter Theorem by geometric arguments: Let T be the triangle on the image plane defined by the three vanishing points of three mutually orthogonal sets of parallel lines in space. Then the image center is the orthocenter of the triangle T (i.e., the common intersection of the three altitudes. 
(1)    Basic proof: use the result of Question 1, assuming the aspect ratio of the camera is 1. Note that you are asked to prove the Orthcenter Theorem, not just the orthcenter of a triangle (7 points)
(2)    If you do not know the  focal length of the camera, can you still find the image center using the Orthocenter Theorem? Explain why or why not (3 points).  Can you also estimate the focal length after you find the image center? If yes, how, and if not, why (5 points)
(3)    If you do not know the aspect ratio and the focal length of the camera, can you still find the image center using the Orthocenter Theorem? Explain why or why not. (5 points)

4. Calibration Programming Exercises (40 points): Implement the direct parameter calibration method in order to (1) learn how to use SVD to solve systems of linear equations; (2) understand the physical constraints of the camera parameters; and (3) understand important issues related to calibration, such as calibration pattern design, point localization accuracy and robustness of the algorithms. Since calibrating a real camera involves lots of work in calibration pattern design, image processing and error controls as well as solving the equations, we will use simulated data to understand the algorithms.  As a by-product we will also learn how to generate 2D images from 3D models using a “virtual” pinhole camera.

  • A.Calibration pattern “design”. Generate data of a “virtual” 3D cube similar to the one shown in here of the lecture notes in camera calibration. For example, you can hypothesize a 1x1x1 m3 cube and pick up coordinates of 3-D points on one corner of each black square in your world coordinate system. Make sure that the number of your 3-D points is sufficient for the following calibration procedures. In order to show the correctness of your data, draw your cube (with the control points marked) using Matlab (or whatever language you are using). I have provided a piece of starting code in Matlab for you to use. (5 points)
  • B. “Virtual” camera and images. Design a “virtual” camera with known intrinsic parameters including focal length f, image center (ox, oy) and pixel size (sx, sy).  As an example, you can assume that the focal length is f = 16 mm, the image frame size is 512*512 (pixels) with an image center (ox,oy) = (256, 256), and the size of the image sensor  inside your camera is 8.8 mm *6.6 mm (so the pixel size is (sx,sy) = (8.8/512, 6.6/512) ). Capture an image of your “virtual” calibration cube with your virtual camera with a given pose (rotation R and translation T).  For example, you can take the picture of the cube 4 meters away and with a tilt angle of 30 degree. Use three rotation angles alpha, beta, gamma to generate the rotation matrix R (refer to the lecture notes in camera model – please double check the equation since it might have typos in signs).  You may need to try different poses in order to have a suitable image of your calibration target. (5 points)
  • C. Direction calibration method: Estimate the intrinsic (fx, fy, aspect ratio a, image center (ox,oy) ) and extrinsic (R, T and further alpha, beta, gamma) parameters. Use SVD to solve the homogeneous linear system and the least square problem, and to enforce the orthogonality constraint on the estimate of R. 

        C(i).      Use the accurately simulated data (both 3D world coordinates and 2D image coordinates) to the algorithms, and compare the results with the “ground truth” data (which are given in step (a) and step (b)).  Remember you are practicing a camera calibration, so you should pretend you know nothing about the camera parameters (i.e. you cannot use the ground truth data in your calibration process). However, in the direct calibration method, you could use the knowledge of the image center (in the homogeneous system to find extrinsic parameters) and the aspect ratio (in the Orthocenter theorem method to find image center).  (15 points)

      C(ii).      Study whether the unknown aspect ratio matters in estimating the image center (5 points), and how the initial estimation of image center affects the estimating of the remaining parameters (5 points), by experimental results.  Give a solution to solve the problems if any (5 points).

    C(iii).      Accuracy Issues. Add in some random noises to the simulated data and run the calibration algorithms again. See how the “design tolerance” of the calibration target and the localization errors of 2D image points affect the calibration accuracy. For example, you can add 0.1 mm (or more) random error to 3D points and 0.5 pixel (or more) random error to 2D points. Also analyze how sensitive of the Orthocenter method is to the extrinsic parameters in imaging the three sets of the orthogonal parallel lines. (* extra points:10)

In all of the steps, you should give you results using either tables or graphs, or both of them.

R- Programming –> Out put PDF file and a screen shot on computer with R program opened date/time of screen should be visible

Write a fully executed R-Markdown program and submit a pdf file solving and answering questions listed below under Problems at the end of chapter 13. For clarity, make sure to give an appropriate title to each section.

13.1 a and b.

13.2 c and d.

Mandatory:
1.
Please provide me a PDF file after execution
2.  screenshot of the computer with R program opened. when executed

Please find the attached textbook and reference 13.1  and 13.2