Question

3. Copy a Picture in JPG format from the internet, divide it into 6 sub-sections and change the location as shown below to cr

0 0
Add a comment Improve this question Transcribed image text
Answer #1

ANS. 3. The image pixel is changed using C++ language. The program is as follows:

#include <iostream>

using namespace std;

int main()
{
int i, j;
int width = 4, height = 4;
  
int img[3][2] = {
{1, 2},
{3, 4},
{5, 6},
};
  
cout << "Image: \n";
for(i=0; i<3; i++)
{
for(j=0; j<2; j++)
{
cout << img[i][j];
cout << "\t";
}
cout << "\n";
}
  
cout<< "Reversed Image: \n";
  
int imgREV[3][2];
  
cout << "Image: \n";
for(i=0; i<3; i++)
{
for(j=0; j<2; j++)
{
imgREV[2-i][1-j] = img[i][j];
}
}
  
int temp = 0;
temp = imgREV[0][1];
imgREV[0][1] = imgREV[1][1];
imgREV[1][1] = temp;
  
for(int m=0; m<3; m++)
{
for(int n=0; n<2; n++)
{
cout << imgREV[m][n];
cout << "\t";
}
cout << "\n";
}

return 0;
}

OUTPUT:

Image: 2 3 4 5 6 Reversed Image: Image: 6 3 4 5 2 1 ... Program finished with exit code 0 Press ENTER to exit console.

ANS. 4. The pseudocode is programmed using C++ language. The program is as follows:

void LG(int x, int y, int n, int new_x)
{   
int sum = 0;
int i = 0;
int f;
  
do{
f = y;
do{
if(i!=j)
{
f = f * (new_x - x)/(xi - xj);
}
j += 1;
}while(j<n)
sum += f;
i += 1;
}while(i<n)
  
}

Add a comment
Know the answer?
Add Answer to:
3. Copy a Picture in JPG format from the internet, divide it into 6 sub-sections and...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Complete Textbook problem 9.18 using Matlab (you can use a 10^-6 as your tolerance) a. Format...

    Complete Textbook problem 9.18 using Matlab (you can use a 10^-6 as your tolerance) a. Format your function such that [x] = lastname_firstname_GaussPivot(A, b). Submit your original M-file. Develop, debug, and test a program in either a high-level language or macro language of your choice to solve a system of equations with Gauss elimination with partial pivoting. Base the program on the pseudocode from Fig. 9.6. Test the program using the following system (which has an answer of x_1 =...

  • expert, please don't copy from the internet and don't answer with a picture only answer with...

    expert, please don't copy from the internet and don't answer with a picture only answer with a text and use APA APA text citation if needed. Thanks, I hope to submit it soon. Nothing is missing. The population of a culture of bacteria is modeled by the logistic equation 14,250 P(t)=1+29e-0.62% To the nearest tenth, how many days will it take the culture to reach 75% of its carrying capacity? What is the carrying capacity? What is the initial population...

  • Please select the output: main         declare X as integer, Y as integer                        &nbsp

    Please select the output: main         declare X as integer, Y as integer                                 set x=1                                 set y=2                                 call sub(x, y)                                 write x                                 write y End program Subprogram sub( integer Num1 as ref, Integer Mum2 as reference)                                                              declare x as integer                                                 set Num1 = 3                                                 set Num2 = 4                                                 set x= 5                                                 write x end subprogram           Please select one:      5/42, 5/34, 5/32, 5/24 What is the output of this...

  • Matlab Problem: please use matlab format, thank you in advance!! Problem 6 (1 point. Instructor's Initials...

    Matlab Problem: please use matlab format, thank you in advance!! Problem 6 (1 point. Instructor's Initials This is Problem 5.20 in the text, with the following corrections and additions: 1) There is an error in the formula for f(x). The correct formula is saies seroatmation dfs ea ee witn m 1,3. 1 2??? -sin 4 /A f(x) = Write a program that accepts as user input the number of terms in the sum. For example, if the user requests 3...

  • Review for Sections 3.2 and 3.3: 1. [3 pts] Use synthetic division to divide x5 –...

    Review for Sections 3.2 and 3.3: 1. [3 pts] Use synthetic division to divide x5 – x4 – 3x3 – 4x2 + 2x – 51 by x – 3. (Show algebraic work.) 2. [4 pts] Solve the equation x3 – 11x2 + 38x – 40 = 0 given that 4 is a zero of f (x) = x3 – 11x2 + 38x – 40. (Show algebraic work.) 3. [5 pts] Answer parts a. – c. below for the given polynomial...

  • IN JAVA ONLY - Please do not copy answers from similar question; those solutions DON'T work. 1. W...

    IN JAVA ONLY - Please do not copy answers from similar question; those solutions DON'T work. 1. Write a hangman’s program where the user is a computer that has to guess the word “JAVA.” The computer uses a BRUTE FORCE method. a. First write the program that shows (prints) each guess (the letter) and also draws the result (line by line, circle by circle) when the guess is wrong. b. What does the brute force method do exactly? c. The...

  • Assignment 6: Recursion Learning Outcomes • Learn how to craft solutions using recursion instead of loops....

    Assignment 6: Recursion Learning Outcomes • Learn how to craft solutions using recursion instead of loops. Instructions This assignment will be different than previous assignments (and most assignments which come after it). In this assignment, you will be crafting four solutions to four different problems. This assignment will also have special requirements regarding how you may code. You are not allowed to use assignment statements. This includes using preincement, postincrement, predecrement, and postdecrement. You are allowed to use assignment to...

  • Write a MATLAB Graphical User Interface (GUI) to simulate and plot the projectile motion – the...

    Write a MATLAB Graphical User Interface (GUI) to simulate and plot the projectile motion – the motion of an object projected into the air at an angle. The object flies in the air until the projectile returns to the horizontal axis (x-axis), where y=0. This MATLAB program should allow the user to try to hit a 2-m diameter target on the x-axis (y=0) by varying conditions, including the lunch direction, the speed of the lunch, the projectile’s size, and the...

  • Objective : Write a C Shell script which copies all files(*.java and *.class) from your home dire...

    Objective : Write a C Shell script which copies all files(*.java and *.class) from your home directory to a new one, and Analyze the new directory information such as number of files, user permissions, and disk usage. Sample Output:                                                    << CS Directory Analysis >>      Date:   ============================================================ Current Directory: /home/tomss New Directory Created : /home/tomss/pgm01 File information Total Number of files : 22 files Directory files:   0 files Plain text files:   10 files File have read permissions: 3 files File have...

  • Nay programming languge is fine (MatLab, Octave, etc.) This is the whole document this last picture...

    Nay programming languge is fine (MatLab, Octave, etc.) This is the whole document this last picture i sent is the first page 5. Write and save a function Sphere Area that accepts Radius as input argument, and returns SurfaceArea (4 tt r) as output argument. Paste the function code below. Paste code here 6. Validate your Sphere Area function from the command line, checking the results against hand calculations. Paste the command line code and results below. 7. Design an...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT